├── .gitattributes ├── .gitignore ├── README.md ├── docs ├── resource │ ├── IconSource │ │ └── font_8ogtnltrgul │ │ │ ├── demo.css │ │ │ ├── demo_index.html │ │ │ ├── iconfont.css │ │ │ ├── iconfont.eot │ │ │ ├── iconfont.js │ │ │ ├── iconfont.json │ │ │ ├── iconfont.svg │ │ │ ├── iconfont.ttf │ │ │ ├── iconfont.woff │ │ │ └── iconfont.woff2 │ ├── System.Windows.Interactivity.dll │ ├── WeMove-SignIn.psd │ ├── log.png │ ├── log.psd │ ├── readme.image │ │ ├── log.png │ │ ├── log48.png │ │ ├── main.png │ │ ├── signin.png │ │ ├── signinpwd.png │ │ └── signup.png │ ├── wemove-sign.0.png │ └── wemove.ico └── tutorial │ ├── MYSQL数据库搭建与测试.md │ ├── WeMove .NET 5移植.md │ ├── WeMove 21年接下来.md │ ├── WeMove 更新数据库到MYSQL8.0.md │ ├── WeMove 界面语言定义和切换.md │ ├── WeMove 登录信息验证调整与焦点获取.md │ ├── WeMove 自定义图标按钮.md │ ├── WeMove 自定义窗口新设计.md │ └── WeMove 错误提供与擦除.md └── src └── Melphily200329.WeMove ├── Deamon ├── App.xaml ├── App.xaml.cs ├── AssemblyInfo.cs ├── Deamon.csproj ├── Deamon.csproj.user ├── Models │ └── MainModule.cs ├── ServiceLocator.cs ├── System.Windows.Interactivity.dll ├── Themes │ ├── DefaultStyles.xaml │ └── Generic.xaml ├── UiCore │ ├── AttachedProperties │ │ ├── BaseAttachedProperty.cs │ │ ├── IsBusyProperty.cs │ │ ├── IsFocusedProperty.cs │ │ ├── IsMaximizedProperty.cs │ │ └── PasswordProperties.cs │ ├── CommonHelper.cs │ ├── Controls │ │ ├── CommandControl.cs │ │ └── IconButton.cs │ ├── Styles │ │ ├── Buttons.xaml │ │ ├── CheckBoxs.xaml │ │ ├── IconButtons.xaml │ │ ├── Languages │ │ │ ├── String.en-US.xaml │ │ │ └── String.zh-CN.xaml │ │ ├── PasswordBoxs.xaml │ │ └── TextBoxs.xaml │ ├── Util │ │ └── AnimationExtensions.cs │ ├── ValueConverters │ │ ├── BooleanToObjectConverter.cs │ │ └── ValueConverter.xaml │ └── WindowResizer.cs ├── ViewModels │ ├── BaseWindowModel.cs │ ├── MainViewModel.cs │ └── Sign │ │ ├── BaseSignInViewModel.cs │ │ ├── SignInMailViewModel.cs │ │ ├── SignInPassViewModel.cs │ │ ├── SignUpViewModel.cs │ │ └── SignViewModel.cs ├── Views │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── SearchView.xaml │ ├── SearchView.xaml.cs │ └── Sign │ │ ├── AnimatableBaseView.cs │ │ ├── SignHost.xaml │ │ ├── SignHost.xaml.cs │ │ ├── SignInMailView.xaml │ │ ├── SignInMailView.xaml.cs │ │ ├── SignInPassView.xaml │ │ ├── SignInPassView.xaml.cs │ │ ├── SignLoadingView.xaml │ │ ├── SignLoadingView.xaml.cs │ │ ├── SignUpView.xaml │ │ ├── SignUpView.xaml.cs │ │ ├── SignWindow.xaml │ │ └── SignWindow.xaml.cs └── wemove.ico ├── MeiOrm ├── BaseSqlService.cs ├── MeiOrm.csproj ├── OperationResult.cs └── SqlConnectionConfig.cs ├── Melphi.Base ├── Binder.cs ├── ExpressionHelpers.cs ├── IBinder.cs ├── IModule.cs ├── Melphi.Base.csproj ├── NotifyPropertyChanged.cs ├── RelayCommand.cs └── ServiceProvider.cs ├── Melphi.Core ├── Melphi.Core.csproj ├── MySql.Data.dll └── MySqlDatabaseEntity.cs ├── Melphi.IconSet ├── FdoiIconSet.cs ├── IIconSet.cs ├── MaterialSet.cs └── Melphi.IconSet.csproj ├── Melphi.WebApi ├── Melphi.WebApi.csproj ├── Program.cs ├── Properties │ └── launchSettings.json ├── WemoveDbService.cs ├── appsettings.Development.json ├── appsettings.json └── wemove_db_sql.txt └── Melphily200329.WeMove.sln /.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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | doc/*/*.ini 13 | 14 | # User-specific files (MonoDevelop/Xamarin Studio) 15 | *.userprefs 16 | 17 | # Build results 18 | [Dd]ebug/ 19 | [Dd]ebugPublic/ 20 | [Rr]elease/ 21 | [Rr]eleases/ 22 | x64/ 23 | x86/ 24 | [Aa][Rr][Mm]/ 25 | [Aa][Rr][Mm]64/ 26 | bld/ 27 | [Bb]in/ 28 | [Oo]bj/ 29 | [Ll]og/ 30 | 31 | # Visual Studio 2015/2017 cache/options directory 32 | .vs/ 33 | # Uncomment if you have tasks that create the project's static files in wwwroot 34 | #wwwroot/ 35 | 36 | # Visual Studio 2017 auto generated files 37 | Generated\ Files/ 38 | 39 | # MSTest test Results 40 | [Tt]est[Rr]esult*/ 41 | [Bb]uild[Ll]og.* 42 | 43 | # NUNIT 44 | *.VisualState.xml 45 | TestResult.xml 46 | 47 | # Build Results of an ATL Project 48 | [Dd]ebugPS/ 49 | [Rr]eleasePS/ 50 | dlldata.c 51 | 52 | # Benchmark Results 53 | BenchmarkDotNet.Artifacts/ 54 | 55 | # .NET Core 56 | project.lock.json 57 | project.fragment.lock.json 58 | artifacts/ 59 | 60 | # StyleCop 61 | StyleCopReport.xml 62 | 63 | # Files built by Visual Studio 64 | *_i.c 65 | *_p.c 66 | *_h.h 67 | *.ilk 68 | *.meta 69 | *.obj 70 | *.iobj 71 | *.pch 72 | *.pdb 73 | *.ipdb 74 | *.pgc 75 | *.pgd 76 | *.rsp 77 | *.sbr 78 | *.tlb 79 | *.tli 80 | *.tlh 81 | *.tmp 82 | *.tmp_proj 83 | *_wpftmp.csproj 84 | *.log 85 | *.vspscc 86 | *.vssscc 87 | .builds 88 | *.pidb 89 | *.svclog 90 | *.scc 91 | 92 | # Chutzpah Test files 93 | _Chutzpah* 94 | 95 | # Visual C++ cache files 96 | ipch/ 97 | *.aps 98 | *.ncb 99 | *.opendb 100 | *.opensdf 101 | *.sdf 102 | *.cachefile 103 | *.VC.db 104 | *.VC.VC.opendb 105 | 106 | # Visual Studio profiler 107 | *.psess 108 | *.vsp 109 | *.vspx 110 | *.sap 111 | 112 | # Visual Studio Trace Files 113 | *.e2e 114 | 115 | # TFS 2012 Local Workspace 116 | $tf/ 117 | 118 | # Guidance Automation Toolkit 119 | *.gpState 120 | 121 | # ReSharper is a .NET coding add-in 122 | _ReSharper*/ 123 | *.[Rr]e[Ss]harper 124 | *.DotSettings.user 125 | 126 | # JustCode is a .NET coding add-in 127 | .JustCode 128 | 129 | # TeamCity is a build add-in 130 | _TeamCity* 131 | 132 | # DotCover is a Code Coverage Tool 133 | *.dotCover 134 | 135 | # AxoCover is a Code Coverage Tool 136 | .axoCover/* 137 | !.axoCover/settings.json 138 | 139 | # Visual Studio code coverage results 140 | *.coverage 141 | *.coveragexml 142 | 143 | # NCrunch 144 | _NCrunch_* 145 | .*crunch*.local.xml 146 | nCrunchTemp_* 147 | 148 | # MightyMoose 149 | *.mm.* 150 | AutoTest.Net/ 151 | 152 | # Web workbench (sass) 153 | .sass-cache/ 154 | 155 | # Installshield output folder 156 | [Ee]xpress/ 157 | 158 | # DocProject is a documentation generator add-in 159 | DocProject/buildhelp/ 160 | DocProject/Help/*.HxT 161 | DocProject/Help/*.HxC 162 | DocProject/Help/*.hhc 163 | DocProject/Help/*.hhk 164 | DocProject/Help/*.hhp 165 | DocProject/Help/Html2 166 | DocProject/Help/html 167 | 168 | # Click-Once directory 169 | publish/ 170 | 171 | # Publish Web Output 172 | *.[Pp]ublish.xml 173 | *.azurePubxml 174 | # Note: Comment the next line if you want to checkin your web deploy settings, 175 | # but database connection strings (with potential passwords) will be unencrypted 176 | *.pubxml 177 | *.publishproj 178 | 179 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 180 | # checkin your Azure Web App publish settings, but sensitive information contained 181 | # in these scripts will be unencrypted 182 | PublishScripts/ 183 | 184 | # NuGet Packages 185 | *.nupkg 186 | # The packages folder can be ignored because of Package Restore 187 | **/[Pp]ackages/* 188 | # except build/, which is used as an MSBuild target. 189 | !**/[Pp]ackages/build/ 190 | # Uncomment if necessary however generally it will be regenerated when needed 191 | #!**/[Pp]ackages/repositories.config 192 | # NuGet v3's project.json files produces more ignorable files 193 | *.nuget.props 194 | *.nuget.targets 195 | 196 | # Microsoft Azure Build Output 197 | csx/ 198 | *.build.csdef 199 | 200 | # Microsoft Azure Emulator 201 | ecf/ 202 | rcf/ 203 | 204 | # Windows Store app package directories and files 205 | AppPackages/ 206 | BundleArtifacts/ 207 | Package.StoreAssociation.xml 208 | _pkginfo.txt 209 | *.appx 210 | 211 | # Visual Studio cache files 212 | # files ending in .cache can be ignored 213 | *.[Cc]ache 214 | # but keep track of directories ending in .cache 215 | !?*.[Cc]ache/ 216 | 217 | # Others 218 | ClientBin/ 219 | ~$* 220 | *~ 221 | *.dbmdl 222 | *.dbproj.schemaview 223 | *.jfm 224 | *.pfx 225 | *.publishsettings 226 | orleans.codegen.cs 227 | 228 | # Including strong name files can present a security risk 229 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 230 | #*.snk 231 | 232 | # Since there are multiple workflows, uncomment next line to ignore bower_components 233 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 234 | #bower_components/ 235 | 236 | # RIA/Silverlight projects 237 | Generated_Code/ 238 | 239 | # Backup & report files from converting an old project file 240 | # to a newer Visual Studio version. Backup files are not needed, 241 | # because we have git ;-) 242 | _UpgradeReport_Files/ 243 | Backup*/ 244 | UpgradeLog*.XML 245 | UpgradeLog*.htm 246 | ServiceFabricBackup/ 247 | *.rptproj.bak 248 | 249 | # SQL Server files 250 | *.mdf 251 | *.ldf 252 | *.ndf 253 | 254 | # Business Intelligence projects 255 | *.rdl.data 256 | *.bim.layout 257 | *.bim_*.settings 258 | *.rptproj.rsuser 259 | *- Backup*.rdl 260 | 261 | # Microsoft Fakes 262 | FakesAssemblies/ 263 | 264 | # GhostDoc plugin setting file 265 | *.GhostDoc.xml 266 | 267 | # Node.js Tools for Visual Studio 268 | .ntvs_analysis.dat 269 | node_modules/ 270 | 271 | # Visual Studio 6 build log 272 | *.plg 273 | 274 | # Visual Studio 6 workspace options file 275 | *.opt 276 | 277 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 278 | *.vbw 279 | 280 | # Visual Studio LightSwitch build output 281 | **/*.HTMLClient/GeneratedArtifacts 282 | **/*.DesktopClient/GeneratedArtifacts 283 | **/*.DesktopClient/ModelManifest.xml 284 | **/*.Server/GeneratedArtifacts 285 | **/*.Server/ModelManifest.xml 286 | _Pvt_Extensions 287 | 288 | # Paket dependency manager 289 | .paket/paket.exe 290 | paket-files/ 291 | 292 | # FAKE - F# Make 293 | .fake/ 294 | 295 | # JetBrains Rider 296 | .idea/ 297 | *.sln.iml 298 | 299 | # CodeRush personal settings 300 | .cr/personal 301 | 302 | # Python Tools for Visual Studio (PTVS) 303 | __pycache__/ 304 | *.pyc 305 | 306 | # Cake - Uncomment if you are using it 307 | # tools/** 308 | # !tools/packages.config 309 | 310 | # Tabs Studio 311 | *.tss 312 | 313 | # Telerik's JustMock configuration file 314 | *.jmconfig 315 | 316 | # BizTalk build output 317 | *.btp.cs 318 | *.btm.cs 319 | *.odx.cs 320 | *.xsd.cs 321 | 322 | # OpenCover UI analysis results 323 | OpenCover/ 324 | 325 | # Azure Stream Analytics local run output 326 | ASALocalRun/ 327 | 328 | # MSBuild Binary and Structured Log 329 | *.binlog 330 | 331 | # NVidia Nsight GPU debugger configuration file 332 | *.nvuser 333 | 334 | # MFractors (Xamarin productivity tool) working folder 335 | .mfractor/ 336 | 337 | # Local History for Visual Studio 338 | .localhistory/ 339 | 340 | # BeatPulse healthcheck temp database 341 | healthchecksdb -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | --- 2 | typora-root-url: ./ 3 | --- 4 | 5 | 6 | 7 | # emailDesktop-WeMove 8 | 9 | ## summary Summary(概要) 10 | 11 | - Wemove is a practical project of WPF technology sharing. 12 | - Wemove是一个练习WPF技术的共享项目。 13 | 14 | 15 | 16 | ## email Screenshots(截图) 17 | 18 | - sign in email page(email verification )登录(邮箱验证) 19 | 20 | email 21 | 22 | 23 | 24 | - sign in password page(password verification )登录(密码验证) 25 | 26 | password 27 | 28 | 29 | 30 | - sign up page(注册) 31 | 32 | password 33 | 34 | 35 | 36 | - main page(主页) 37 | 38 | main 39 | 40 | 41 | 42 | ## 数据库 43 | 44 | 数据库表内容 45 | 46 | ```mysql 47 | CREATE TABLE `user_info` ( 48 | `Id` int(11) NOT NULL AUTO_INCREMENT, 49 | `UserName` varchar(255) DEFAULT NULL COMMENT '用户名', 50 | `Email` varchar(255) NOT NULL DEFAULT '' COMMENT '邮箱', 51 | `Password` varchar(255) NOT NULL DEFAULT '' COMMENT '密码', 52 | `CreateDate` date DEFAULT '2020-07-16' COMMENT '创建日期', 53 | PRIMARY KEY (`Id`) 54 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户信息表'; 55 | ``` 56 | 57 | C#链接字符串(本地数据库) 58 | 59 | ```c# 60 | string ConnectionString = @"server = 127.0.0.1; userid = root; password = deamon; database = wemove; persistsecurityinfo = True;"; 61 | ``` 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /docs/resource/IconSource/font_8ogtnltrgul/iconfont.css: -------------------------------------------------------------------------------- 1 | @font-face {font-family: "iconfont"; 2 | src: url('iconfont.eot?t=1583248561135'); /* IE9 */ 3 | src: url('iconfont.eot?t=1583248561135#iefix') format('embedded-opentype'), /* IE6-IE8 */ 4 | url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAegAAsAAAAAEjAAAAdRAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCFFAqSaI5fATYCJANQCyoABCAFhG0HgnMbNA8jETaMcsIl++sDGxxxAyTDcEPNcgNnDjkU9GZ0viaCk0LoZcHvHv34Wng99LOf86H3rDczaSqlS7oLHSB+gf06KgegmzrrM68eluDY+5lWnNAgJ65BOVkuBADx3659M1lCsRUl/CUJqDm+Sbf3od3grtMT3yrim68QaiJhbFjFnmnS9qttNjrTR8BNaXhXeLklamp1Wg9d/7Ufq7pF9UZoZG/tm7wFFlVtYomhMYQkJsmkRGh4STdX4pXQDwIeb98Nrka9CZ84HggABVwEIVk5RVWQgYMrEUr17NalDbJKELgeQwKZHy/YlgOZiz3I6DR6BcCc5O3JG0REBlBIGNx1yzpnd0SayERPNtY69jtSALNeBABtIYABCAJwGlorDFgOZOIYMyjW2UVvABrIQMGL3sJ60SQ6ii6ip9W6tqipWtuKzqJ7fckpgQYChygPXmxEwcBBAh5SyCCX/5OnhApqaKCFjp6BEQgPV1ah+jXbCCILXIEAIucKFBAlEvqARwKgQQKgRQKgA0MK6MGQASYw5IAtGArADgwlYA+GCnAAQw04ImE/cEYC4IIEwB0JgAcYBsCTKjACACHaxg/gA/QOwIbARSsTf+Ih9m6S6aeGkhU5qomJydXw0imowo16nZ9hVMscVQHhRekNenndzCCVrgpb0HKZgqE7OF6J5smnsy6gioecnObHpuUWgEodkss4eQWedvJGnCYtwq8xvIx2BzVh7HxZgtI6NDKsVspZopndSRAj6my/7/cPF7JvPUXvXfliTlzUP6LPvuLvi/TJO15c8y506C/LwD/AXhA0dkaBMm+O+i3RZ8Y+vPI+gw36S15++T7qt8cBtT5m59+x45vqDxqwRRwBrOQYGdSrAXSTkQtQAwt8VbffHt1hSfLGeaxAAdiAuV2vXp/Xw83uE64y6TwslLL+JOKnC0+gPIWWiEtoI3CZUZm+Ij1HRAyiWytjYmKU91CwRQZhmlhEKngp9i/A/AxDfRD20UXYmrDsV2MUWSyScnYM0H1skzzhwfu0Iuy3/Jr7SfeHbs1yx0Kq6sIhus6/X3qFL2q3H2l99Tew1AtZpaI4whWyHB4oqBjOd53vahWn4TXyl6oL4OfT17Wivsd/A0h2yE6e44CaHYlad+emV+WaO/ejsvrhr21zKPumurBBLbXIydgtxPpXifQTGsav48mmdRbL3eTF+m5dl+5yP9nSrt30iydPs1j+V2BdU7uG+2CrFOwIGo/dvz/Ep59a/VUb3lZEv/YWaRpuONxo0CSDmvvU3EudF6+3JB+ZsVXRV7F1RrpU7wic+aiIjIlUuEQFrMHjqNioEsV6SD2a7nO7ym+MyyRmMwmFTAj+bN4Yd1gtnBDShyo2zvub8XfeRs/8dQf6H1iXv6bRUi3L3htXcjyu9Ey2rNpS2PX39OYPPQLGWe1e1+3vtyEvv7bs0LyNw3beV3pw5vSqxPt+95ctC593SV1JVPCYsIGv8/OvcSfS3qam3vdTDcrKCinid0fl7T3VtOV3pl+WGi98TwxcaE7q2rDtftvD+vZlcQG2VjhhHDMxqG9fAVkWhVtQjzEp3csIBz0wdgq1SmMD+hldumRhbOiKjxk3q/0jid7qqvEH/IBwDfFT/c2xnY583PAosHwc183jw3LGT+UZk/klxeScF4TDsTlBfjLmPlF5N8n0D5FmY782x0cHHh0ZmJsfPzTfMAPd/D5syfrR7d497e29tpx9zodKlH/kqiENDbZms2308p1N79VlodXNquEZ8+adq/AZvX5tiTwjUl7SJVtdvDRPP3HYMzUZgr5LGl326wNdGq2Rj4lLszyypiUmRWKM9SMBdIJHJyp7zRijYaqMERnX0XFGlPYyoWdpWdQ4ur2KHksqaSZsPN3rXrDvNHrWOICeNg6lO2Mc6Yq/l8th6OKgyy3apG8y5b/QKXcmLtonidwJgoA/epQbTYC/jszIdtyVk4OFZv8bAb16tCC7RJ9BVHj9gL+WcQYPJGQazfxpRqbCjkIKZ5GJVL1EDtUgOwmUiBJ5VFPtFAiUu7MSRv3BQDg5gACTsCPQ2WNHocEZkaF6VeRQvW8ngY13Ao9umJ0CNcS4TyV89kq34wgkgxFqI5zGZP1QPk5Lv8FQgiSJU1b7AsoOk+jq9p77DAlojQ3ycuiZrbCEUTxd1oEQUEyEC9Bcj+RM86axxoa1xjg7nkUgOXJqBLVx6zQmOzwfN17/DYYSJPU06rj9Aspu7kKn1o5QfJbTqEbPUjEvhx5LEVYEGYQxQ09yBAQvC4VJvNQCNNfGGRnTXCN1ZsfK9f4ofgRkvPmadP9mIVSUZEXVdMO0bMf16BkYCUzhwhp0lSTCVRXA8mV1VnLDyGfqgDINFUwQlI4pogNmOMqTI6Si2E5Bbo6TZcmwaIUlhhKhGtUO1zXCn2FciRfXpICrO2NKLAyTOn8QMDM7v72S05nbu9kSQtYEkCpYO764wMkRyTcrwkdjq4oLhlw3kmczAAA=') format('woff2'), 5 | url('iconfont.woff?t=1583248561135') format('woff'), 6 | url('iconfont.ttf?t=1583248561135') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ 7 | url('iconfont.svg?t=1583248561135#iconfont') format('svg'); /* iOS 4.1- */ 8 | } 9 | 10 | .iconfont { 11 | font-family: "iconfont" !important; 12 | font-size: 16px; 13 | font-style: normal; 14 | -webkit-font-smoothing: antialiased; 15 | -moz-osx-font-smoothing: grayscale; 16 | } 17 | 18 | .icon-fdoi-arrow-left:before { 19 | content: "\e603"; 20 | } 21 | 22 | .icon-fdoi-arrow-right:before { 23 | content: "\e604"; 24 | } 25 | 26 | .icon-fdoi-arrow-up:before { 27 | content: "\e605"; 28 | } 29 | 30 | .icon-fdoi-arrow-down:before { 31 | content: "\e606"; 32 | } 33 | 34 | .icon-fdoi-close:before { 35 | content: "\e60e"; 36 | } 37 | 38 | .icon-fdoi-menu:before { 39 | content: "\e60f"; 40 | } 41 | 42 | .icon-fdoi-play:before { 43 | content: "\e610"; 44 | } 45 | 46 | .icon-fdoi-pause:before { 47 | content: "\e611"; 48 | } 49 | 50 | .icon-fdoi-volume-high:before { 51 | content: "\e615"; 52 | } 53 | 54 | .icon-fdoi-volume-medium:before { 55 | content: "\e617"; 56 | } 57 | 58 | .icon-fdoi-volume-low:before { 59 | content: "\e618"; 60 | } 61 | 62 | .icon-fdoi-mute-volume-high:before { 63 | content: "\e619"; 64 | } 65 | 66 | .icon-fdoi-mute-volume-medium:before { 67 | content: "\e61a"; 68 | } 69 | 70 | .icon-fdoi-mute-volume-low:before { 71 | content: "\e61b"; 72 | } 73 | 74 | .icon-fdoi-fullscreen-exit:before { 75 | content: "\e61d"; 76 | } 77 | 78 | .icon-fdoi-fullscreen:before { 79 | content: "\e61e"; 80 | } 81 | 82 | .icon-fdoi-person:before { 83 | content: "\e621"; 84 | } 85 | 86 | .icon-fdoi-build:before { 87 | content: "\e622"; 88 | } 89 | 90 | .icon-fdoi-edit:before { 91 | content: "\e623"; 92 | } 93 | 94 | -------------------------------------------------------------------------------- /docs/resource/IconSource/font_8ogtnltrgul/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/IconSource/font_8ogtnltrgul/iconfont.eot -------------------------------------------------------------------------------- /docs/resource/IconSource/font_8ogtnltrgul/iconfont.js: -------------------------------------------------------------------------------- 1 | !function(n){var a,d='',o=(a=document.getElementsByTagName("script"))[a.length-1].getAttribute("data-injectcss");if(o&&!n.__iconfont__svg__cssinject__){n.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}!function(a){if(document.addEventListener)if(~["complete","loaded","interactive"].indexOf(document.readyState))setTimeout(a,0);else{var o=function(){document.removeEventListener("DOMContentLoaded",o,!1),a()};document.addEventListener("DOMContentLoaded",o,!1)}else document.attachEvent&&(t=a,i=n.document,l=!1,(d=function(){try{i.documentElement.doScroll("left")}catch(a){return void setTimeout(d,50)}e()})(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,e())});function e(){l||(l=!0,t())}var t,i,l,d}(function(){var a,o,e,t,i,l;(a=document.createElement("div")).innerHTML=d,d=null,(o=a.getElementsByTagName("svg")[0])&&(o.setAttribute("aria-hidden","true"),o.style.position="absolute",o.style.width=0,o.style.height=0,o.style.overflow="hidden",e=o,(t=document.body).firstChild?(i=e,(l=t.firstChild).parentNode.insertBefore(i,l)):t.appendChild(e))})}(window); -------------------------------------------------------------------------------- /docs/resource/IconSource/font_8ogtnltrgul/iconfont.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "", 3 | "name": "", 4 | "font_family": "iconfont", 5 | "css_prefix_text": "icon-", 6 | "description": "", 7 | "glyphs": [ 8 | { 9 | "icon_id": "13220932", 10 | "name": "fdoi-arrow-left", 11 | "font_class": "fdoi-arrow-left", 12 | "unicode": "e603", 13 | "unicode_decimal": 58883 14 | }, 15 | { 16 | "icon_id": "13220933", 17 | "name": "fdoi-arrow-right", 18 | "font_class": "fdoi-arrow-right", 19 | "unicode": "e604", 20 | "unicode_decimal": 58884 21 | }, 22 | { 23 | "icon_id": "13220934", 24 | "name": "fdoi-arrow-up", 25 | "font_class": "fdoi-arrow-up", 26 | "unicode": "e605", 27 | "unicode_decimal": 58885 28 | }, 29 | { 30 | "icon_id": "13220935", 31 | "name": "fdoi-arrow-down", 32 | "font_class": "fdoi-arrow-down", 33 | "unicode": "e606", 34 | "unicode_decimal": 58886 35 | }, 36 | { 37 | "icon_id": "13221144", 38 | "name": "fdoi-close", 39 | "font_class": "fdoi-close", 40 | "unicode": "e60e", 41 | "unicode_decimal": 58894 42 | }, 43 | { 44 | "icon_id": "13221151", 45 | "name": "fdoi-menu", 46 | "font_class": "fdoi-menu", 47 | "unicode": "e60f", 48 | "unicode_decimal": 58895 49 | }, 50 | { 51 | "icon_id": "13221212", 52 | "name": "fdoi-play", 53 | "font_class": "fdoi-play", 54 | "unicode": "e610", 55 | "unicode_decimal": 58896 56 | }, 57 | { 58 | "icon_id": "13221213", 59 | "name": "fdoi-pause", 60 | "font_class": "fdoi-pause", 61 | "unicode": "e611", 62 | "unicode_decimal": 58897 63 | }, 64 | { 65 | "icon_id": "13221683", 66 | "name": "fdoi-volume-high", 67 | "font_class": "fdoi-volume-high", 68 | "unicode": "e615", 69 | "unicode_decimal": 58901 70 | }, 71 | { 72 | "icon_id": "13221686", 73 | "name": "fdoi-volume-medium", 74 | "font_class": "fdoi-volume-medium", 75 | "unicode": "e617", 76 | "unicode_decimal": 58903 77 | }, 78 | { 79 | "icon_id": "13221687", 80 | "name": "fdoi-volume-low", 81 | "font_class": "fdoi-volume-low", 82 | "unicode": "e618", 83 | "unicode_decimal": 58904 84 | }, 85 | { 86 | "icon_id": "13221688", 87 | "name": "fdoi-mute-volume-high", 88 | "font_class": "fdoi-mute-volume-high", 89 | "unicode": "e619", 90 | "unicode_decimal": 58905 91 | }, 92 | { 93 | "icon_id": "13221689", 94 | "name": "fdoi-mute-volume-medium", 95 | "font_class": "fdoi-mute-volume-medium", 96 | "unicode": "e61a", 97 | "unicode_decimal": 58906 98 | }, 99 | { 100 | "icon_id": "13221690", 101 | "name": "fdoi-mute-volume-low", 102 | "font_class": "fdoi-mute-volume-low", 103 | "unicode": "e61b", 104 | "unicode_decimal": 58907 105 | }, 106 | { 107 | "icon_id": "13221701", 108 | "name": "fdoi-fullscreen-exit", 109 | "font_class": "fdoi-fullscreen-exit", 110 | "unicode": "e61d", 111 | "unicode_decimal": 58909 112 | }, 113 | { 114 | "icon_id": "13221702", 115 | "name": "fdoi-fullscreen", 116 | "font_class": "fdoi-fullscreen", 117 | "unicode": "e61e", 118 | "unicode_decimal": 58910 119 | }, 120 | { 121 | "icon_id": "13221716", 122 | "name": "fdoi-person", 123 | "font_class": "fdoi-person", 124 | "unicode": "e621", 125 | "unicode_decimal": 58913 126 | }, 127 | { 128 | "icon_id": "13221717", 129 | "name": "fdoi-build", 130 | "font_class": "fdoi-build", 131 | "unicode": "e622", 132 | "unicode_decimal": 58914 133 | }, 134 | { 135 | "icon_id": "13221722", 136 | "name": "fdoi-edit", 137 | "font_class": "fdoi-edit", 138 | "unicode": "e623", 139 | "unicode_decimal": 58915 140 | } 141 | ] 142 | } 143 | -------------------------------------------------------------------------------- /docs/resource/IconSource/font_8ogtnltrgul/iconfont.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Created by iconfont 9 | 10 | 11 | 12 | 13 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 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 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/resource/IconSource/font_8ogtnltrgul/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/IconSource/font_8ogtnltrgul/iconfont.ttf -------------------------------------------------------------------------------- /docs/resource/IconSource/font_8ogtnltrgul/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/IconSource/font_8ogtnltrgul/iconfont.woff -------------------------------------------------------------------------------- /docs/resource/IconSource/font_8ogtnltrgul/iconfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/IconSource/font_8ogtnltrgul/iconfont.woff2 -------------------------------------------------------------------------------- /docs/resource/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /docs/resource/WeMove-SignIn.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/WeMove-SignIn.psd -------------------------------------------------------------------------------- /docs/resource/log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/log.png -------------------------------------------------------------------------------- /docs/resource/log.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/log.psd -------------------------------------------------------------------------------- /docs/resource/readme.image/log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/readme.image/log.png -------------------------------------------------------------------------------- /docs/resource/readme.image/log48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/readme.image/log48.png -------------------------------------------------------------------------------- /docs/resource/readme.image/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/readme.image/main.png -------------------------------------------------------------------------------- /docs/resource/readme.image/signin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/readme.image/signin.png -------------------------------------------------------------------------------- /docs/resource/readme.image/signinpwd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/readme.image/signinpwd.png -------------------------------------------------------------------------------- /docs/resource/readme.image/signup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/readme.image/signup.png -------------------------------------------------------------------------------- /docs/resource/wemove-sign.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/wemove-sign.0.png -------------------------------------------------------------------------------- /docs/resource/wemove.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/docs/resource/wemove.ico -------------------------------------------------------------------------------- /docs/tutorial/MYSQL数据库搭建与测试.md: -------------------------------------------------------------------------------- 1 | # MYSQL数据库搭建与测试 2 | 3 | 安装MYSQL 5.5版本 4 | 5 | start server失败时, 6 | 7 | 1.先检查C盘的Program Files Program Files(X86) Windows 有没有 MYSQL文件,有就删除 8 | 9 | 2.检查我们使用的端口(例如3306)有没有被占用,如果有就把那个程序给暂停。(切换一个没有工作的端口)。 10 | 11 | 12 | 13 | 14 | 15 | 安装MYSQL-FONT可视化工具 16 | 17 | 登录到本地 18 | 19 | 新建数据库 wemove 20 | 21 | 新建用户信息表 user_info 及其相关字段 22 | 23 | ```mysql 24 | CREATE TABLE `user_info` ( 25 | `Id` int(11) NOT NULL AUTO_INCREMENT, 26 | `UserName` varchar(255) DEFAULT NULL COMMENT '用户名', 27 | `Email` varchar(255) NOT NULL DEFAULT '' COMMENT '邮箱', 28 | `Password` varchar(255) NOT NULL DEFAULT '' COMMENT '密码', 29 | `CreateDate` date DEFAULT '2020-07-16' COMMENT '创建日期', 30 | PRIMARY KEY (`Id`) 31 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户信息表'; 32 | ``` 33 | 34 | 新增一行数据(用于测试使用) 35 | 36 | 在WeMove项目添加Mysql.Data 37 | 38 | 添加数据库访问帮助类MySqlDatabaseHelper 39 | 40 | ```c# 41 | public class MySqlDatabaseHelper 42 | { 43 | private string dbConnStr; 44 | private MySqlConnection dbConn = null; 45 | 46 | 47 | public MySqlDatabaseHelper(string connectionString) 48 | { 49 | dbConnStr = connectionString; 50 | dbConn = new MySqlConnection(dbConnStr); 51 | } 52 | 53 | ~MySqlDatabaseHelper() 54 | { 55 | Close(); 56 | } 57 | 58 | public void Open() 59 | { 60 | dbConn.Open(); 61 | } 62 | 63 | public void Close() 64 | { 65 | dbConn.Close(); 66 | } 67 | 68 | public DataSet ExecuteSelect(string sql) 69 | { 70 | var mycom = dbConn.CreateCommand(); 71 | mycom.CommandText = sql; 72 | MySqlDataAdapter adap = new MySqlDataAdapter(mycom); 73 | DataSet ds = new DataSet(); 74 | adap.Fill(ds); 75 | return ds; 76 | } 77 | 78 | } 79 | ``` 80 | 81 | 登录时,查询邮箱 82 | 83 | ```c# 84 | await Task.Run(() => 85 | { 86 | 87 | string ConnectionString = "server = 127.0.0.1; userid = root; password = deamon; database = wemove; persistsecurityinfo = True;"; 88 | MySqlDatabaseHelper mduser = new MySqlDatabaseHelper(ConnectionString); 89 | 90 | // 打开数据库 91 | mduser.Open(); 92 | 93 | // sql 查询语句 94 | string sqlCmdStr = "select Email from user_info"; 95 | 96 | var data = mduser.ExecuteSelect(sqlCmdStr); 97 | if (data.Tables[0] != null && data.Tables[0].Rows.Count > 0) 98 | { 99 | var datt = data.Tables[0]; 100 | 101 | if (datt.Rows[0]["Email"].ToString() == email) 102 | { 103 | App.Current.Dispatcher.Invoke(() => ServiceProvider.Get().CurrentView = new Views.Sign.SignInPassView()); 104 | } 105 | } 106 | 107 | // 关闭数据库 108 | mduser.Close(); 109 | 110 | }); 111 | 112 | ``` 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | SQL操作资料 125 | 126 | ```c# 127 | string ConnectionString = "server = 127.0.0.1; userid = root; password = deamon; database = mduser; persistsecurityinfo = True;"; 128 | MySqlDatabaseHelper mduser = new MySqlDatabaseHelper(ConnectionString); 129 | 130 | // 打开数据库 131 | mduser.Open(); 132 | 133 | // sql 查询语句 134 | string sqlCmdStr = null; 135 | 136 | //// 新增记录 137 | //sqlCmdStr = "insert into chipinfo_20200209(chipid, chiptype) values('5','S10')"; 138 | //mduser.ExecuteNonQuery(sqlCmdStr); 139 | 140 | //// 删除记录 141 | //sqlCmdStr = "delete from chipinfo_20200209 where chipid = 4"; 142 | //mduser.ExecuteNonQuery(sqlCmdStr); 143 | 144 | //// 修改数据 145 | //sqlCmdStr = "update chipinfo_20200209 set boardid = '666' where chipid = '5'"; 146 | //mduser.ExecuteNonQuery(sqlCmdStr); 147 | 148 | // 查询数据 149 | sqlCmdStr = "select * from chipinfo_20200209"; 150 | MySql.Data.MySqlClient.MySqlDataReader dataReader = mduser.ExecuteReader(sqlCmdStr); 151 | while (dataReader.Read()) 152 | { 153 | string str = dataReader["chiptype"].ToString(); 154 | } 155 | dataReader.Close(); 156 | 157 | // 关闭数据库 158 | mduser.Close(); 159 | ``` 160 | 161 | -------------------------------------------------------------------------------- /docs/tutorial/WeMove .NET 5移植.md: -------------------------------------------------------------------------------- 1 | ## 2021 01 09 2 | 3 | 4 | 5 | ### WeMove .NET 5.0 平台移植 6 | 7 | 环境: 8 | 9 | 1.如果没有下载.NET 5.0 的SDK,可以先下载SDK 10 | 11 | https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install 12 | 13 | https://dotnet.microsoft.com/download 14 | 15 | 2.需要更新VS2019到 16.8.3版本 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/tutorial/WeMove 21年接下来.md: -------------------------------------------------------------------------------- 1 | ## 2021 01 31 2 | 3 | 4 | 5 | **WEMOVE** 6 | 7 | ### 接下来想要去完成得事情 8 | 9 | 10 | 11 | 1. 完善对数据库得基本操作。(增、删、查、改) 12 | 1. 增:新增注册页面; 13 | 2. 改:新增忘记密码自主修改密码功能; 14 | 3. 删:新增注销用户页面; 15 | 2. 整理代码和注释提示,使用全英文(百度翻译)编写。(督促学习英语) 16 | 3. 添加语言切换功能 17 | 4. 完善开发文档,详细介绍该项目的功能以及如何使用,便于开发者学习和应用。 18 | 5. 构思项目内容,做自己喜欢的事情。 19 | 20 | 21 | 22 | 23 | 24 | ## 2021 02 15 25 | 26 | ### WeMove 登录设计.7-注册页面 27 | 28 | HintTag 提示标签文本框和密码框样式设计 29 | 30 | 注册信息验证与注册 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | ## 2021 10 24 39 | 40 | 41 | 42 | 1.将signwindow的高度根据切换页面进行修改 43 | 44 | 2.根据signin页面设计signup界面 45 | 46 | 3.新建signupViewmodel 47 | 48 | 4.实现信息注册并跳转到主页(MYSLQL数据插入) 49 | 50 | 51 | 52 | 1.整合项目,在base代码的基础上,整合注册功能 53 | 54 | ​ 1.注册页面的高度,自动变化。 55 | 56 | ​ 2.输入框的样式,具有HintTag 样式效果。 57 | 58 | ​ 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 1.输入框输入BUG修复 67 | 68 | 2.ViewablePasswordBox(密码可见密码框设计) 69 | 70 | 3.EyePressedButton(按下睁眼按钮设计) 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/tutorial/WeMove 界面语言定义和切换.md: -------------------------------------------------------------------------------- 1 | ## 2021 10 01 2 | 3 | 4 | 5 | ### WeMove 界面语言定义和切换 6 | 7 | 8 | 9 | 1. 添加string.zh-CN.xaml字体资源文件 10 | 2. 将资源文件在APP.xaml文件种引入 11 | 3. 界面呈现文本的地方,修改文本的呈现方式为绑定动态资源 12 | 4. 在APP.xaml.cs文件种定义公共静态属性Language,当属性发生变化时,修改当前的使用的资源文件 13 | 14 | 15 | 16 | 字符串XAML命令空间引用 17 | 18 | ``` 19 | xmlns:sys="clr-namespace:System;assembly=mscorlib" 20 | ``` 21 | 22 | 23 | 24 | 25 | 26 | 资源切换 27 | 28 | ```c# 29 | List dictionaryList = new List(); 30 | foreach (ResourceDictionary dictionary in Application.Current.Resources.MergedDictionaries) 31 | { 32 | dictionaryList.Add(dictionary); 33 | } 34 | string requestedLanguage = string.Format(@"UiCore/Styles/Languages/String.{0}.xaml", Language); 35 | ResourceDictionary resourceDictionary = dictionaryList.FirstOrDefault(d => d.Source.OriginalString.Equals(requestedLanguage)); 36 | if (resourceDictionary == null) 37 | { 38 | requestedLanguage = @"UiCore/Styles/Languages/String.zh-CN.xaml"; 39 | resourceDictionary = dictionaryList.FirstOrDefault(d => d.Source.OriginalString.Equals(requestedLanguage)); 40 | } 41 | if (resourceDictionary != null) 42 | { 43 | Application.Current.Resources.MergedDictionaries.Remove(resourceDictionary); 44 | Application.Current.Resources.MergedDictionaries.Add(resourceDictionary); 45 | } 46 | ``` 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/tutorial/WeMove 登录信息验证调整与焦点获取.md: -------------------------------------------------------------------------------- 1 | ## 2020 08 30 2 | 3 | ### WeMove 登录信息验证调整与焦点获取 4 | 5 | 6 | 7 | 8 | 9 | 1.将登录验证类整理,提高代码复用 10 | 11 | 我们验证密码和邮箱的窗口有部分重复的参数,将其规整到父类中,从而提高代码复用。 12 | 13 | 1.1添加抽象父类BaseSignInViewModel,将共有的信息集中起来 14 | 15 | ```c# 16 | /// 17 | /// The base class of sign in information verification 18 | /// 19 | public abstract class BaseSignInViewModel : NotifyPropertyChanged 20 | { 21 | private bool hasError = false; 22 | 23 | /// 24 | /// has a error occured 25 | /// 26 | public bool HasError 27 | { 28 | get { return hasError; } 29 | set { hasError = value; OnPropertyChanged(); } 30 | } 31 | 32 | private string errorMessage = ""; 33 | 34 | /// 35 | /// the error message 36 | /// 37 | public string ErrorMessage 38 | { 39 | get { return errorMessage; } 40 | set { errorMessage = value; OnPropertyChanged(); } 41 | } 42 | 43 | private bool needRemember; 44 | 45 | /// 46 | /// Remember this input and fill in automatically next time 47 | /// 48 | public bool NeedRemember 49 | { 50 | get { return needRemember; } 51 | set { needRemember = value; OnPropertyChanged(); } 52 | } 53 | 54 | private bool canSign; 55 | 56 | /// 57 | /// Is ture U Can Sign In 58 | /// 59 | public bool CanSign 60 | { 61 | get { return canSign; } 62 | set { canSign = value; OnPropertyChanged(); } 63 | } 64 | 65 | private bool isSigning; 66 | 67 | /// 68 | /// Show the status of Sign Button is Running or not 69 | /// 70 | public bool IsSigning 71 | { 72 | get { return isSigning; } 73 | set { isSigning = value; OnPropertyChanged(); } 74 | } 75 | 76 | /// 77 | /// Validate the command 78 | /// 79 | public abstract ICommand SignCommand { get; set; } 80 | 81 | /// 82 | /// Skip to other (like SignUp or SignInEmail) page command 83 | /// 84 | public abstract ICommand GotoCommand { get; set; } 85 | 86 | /// 87 | /// Wait for a while, then erase the error message display 88 | /// 89 | /// The number of milliseconds to wait 90 | protected void WipeErrorAffterMS(int ms = 2000) 91 | { 92 | Task.Run(() => 93 | { 94 | System.Threading.Thread.Sleep(ms); 95 | ErrorMessage = ""; 96 | HasError = false; 97 | }); 98 | } 99 | } 100 | ``` 101 | 102 | 1.2修改对应SignInPass和Mail的ViewModel继承关系。 103 | 104 | 2调整界面,默认焦点到输入框,与默认ENter在登录按钮上 105 | 106 | 2.1添加IsFocusedProperty附加属性,用于设置控件的Focus状态 107 | 108 | 2.2设置控件可以获取焦点,通过tab切换 109 | 110 | 当获取焦点时,通过变色提示用户【button checkbox】 111 | 112 | 3.将注释统一成英文(直接使用百度翻译) 113 | 114 | 115 | 116 | 117 | 118 | WPF WeMove 验证结构调整与焦点获取 119 | 120 | 1.调整类之间结构,提高代码复用 121 | 2.TextBox、Password等控件默认获取焦点 122 | 3.一般控件获取焦点后样式设置。 123 | 项目开源地址:https://github.com/mefdeamon/Desktop-WeMove 124 | 125 | 126 | -------------------------------------------------------------------------------- /docs/tutorial/WeMove 自定义图标按钮.md: -------------------------------------------------------------------------------- 1 | ## 2020 09 01 2 | 3 | 4 | 5 | ### WeMove 自定义图标按钮 6 | 7 | 8 | 9 | 1.丰富项目的图标库 10 | 11 | 2.创建IconButton自定义控件,并添加IconData属性 12 | 13 | 3.使用IconButon,设计弹性样式 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | WPF WeMove 弹性图标按钮样式设计 22 | 23 | 1.创建IconButton自定义控件,并添加IconData属性 24 | 2.使用IconButon,设计弹性样式 25 | 3.丰富项目的图标库 26 | 27 | 28 | 29 | 30 | 31 | 注册窗口完善 32 | 33 | 主窗口出发, 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/tutorial/WeMove 自定义窗口新设计.md: -------------------------------------------------------------------------------- 1 | ## 2020 08 31 2 | 3 | 4 | 5 | ### WeMove 自定义窗口新设计 6 | 7 | 8 | 9 | 10 | 11 | 1.最大化,窗口化 12 | 13 | 1.1解决最大化,窗口不能正确在任务栏之上展示 14 | 15 | 添加WindowResizer类【别人的】 16 | 17 | 实现一个可以控制设置的自定义ViewModel【根据别人改的】 18 | 19 | 修改Style,给界面添加一个雏形 20 | 21 | 22 | 23 | 1.2通过附加依赖属性,在Style中提示当前处于什么状态,并做对应UI展示 24 | 25 | IsMaximizedProperty附加属性 26 | 27 | 在BaseWindowModel中添加IsMaximized属性用于获取当前窗口状态,展示对应信息 28 | 29 | 功能按钮提示功能,与动画 30 | 31 | 1.3添加窗体自动缩放和调整大小功能 32 | 33 | 1.4Box光标焦点问题 34 | 35 | TextBox 36 | 37 | ``` 38 | if (sender is TextBox textBox) 39 | { 40 | // Set the cursor at the end of the last character 41 | textBox.SelectionStart = textBox.Text.Length; 42 | } 43 | ``` 44 | 45 | PasswordBox 46 | 47 | ``` 48 | if (sender is PasswordBox passwordBox) 49 | { 50 | // Set the cursor at the end of the last character 51 | passwordBox.GetType() 52 | .GetMethod("Select", BindingFlags.Instance | BindingFlags.NonPublic) 53 | .Invoke(passwordBox, new object[] { passwordBox.Password.Length, passwordBox.Password.Length }); 54 | } 55 | ``` 56 | 57 | 58 | 59 | 60 | 61 | WPF WeMove 自定义窗口样式设计2 62 | 63 | 1.使用WindowResizer类实现窗口的Dock样式 64 | 2.最大化、窗口化图标动画提示。 65 | 3.TextBox与PasswordBox控件光标焦点。 66 | 项目开源地址:https://github.com/mefdeamon/Desktop-WeMove 67 | 68 | 69 | -------------------------------------------------------------------------------- /docs/tutorial/WeMove 错误提供与擦除.md: -------------------------------------------------------------------------------- 1 | # WeMove 错误提供与自动擦除 2 | 3 | 定义错误提示的UI 4 | 5 | ```xaml 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | ``` 19 | 20 | 定义绑定的属性 21 | 22 | ```c# 23 | 24 | private bool hasError; 25 | 26 | /// 27 | /// Has error then show the ErrorMessage 28 | /// 29 | public bool HasError 30 | { 31 | get { return hasError; } 32 | set { hasError = value; OnPropertyChanged(); } 33 | } 34 | 35 | 36 | private string errorMessage; 37 | 38 | /// 39 | /// the error message 40 | /// 41 | public string ErrorMessage 42 | { 43 | get { return errorMessage; } 44 | set { errorMessage = value; OnPropertyChanged(); } 45 | } 46 | 47 | ``` 48 | 49 | 邮箱格式校验(正则表达式) 50 | 51 | ```c# 52 | public static class CommonHelper 53 | { 54 | /// 55 | /// 是邮箱 56 | /// 57 | /// 58 | /// 59 | public static bool IsEmail(this string source) 60 | { 61 | return Regex.IsMatch(source, @"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$", RegexOptions.IgnoreCase); 62 | } 63 | } 64 | ``` 65 | 66 | 消息自动擦除 67 | 68 | ```c# 69 | /// 70 | /// 延迟一段时间,擦除错误消息 71 | /// 72 | /// 延迟时间 单位:毫秒 73 | private void WipeErrorAffterMS(int ms) 74 | { 75 | Task.Run(() => 76 | { 77 | Thread.Sleep(ms); 78 | HasError = false; 79 | ErrorMessage = ""; 80 | }); 81 | } 82 | ``` 83 | 84 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using Deamon.Models; 2 | using Melphi.Base; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Configuration; 6 | using System.Data; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | 11 | namespace Deamon 12 | { 13 | /// 14 | /// Interaction logic for App.xaml 15 | /// 16 | public partial class App : Application 17 | { 18 | protected override void OnStartup(StartupEventArgs e) 19 | { 20 | base.OnStartup(e); 21 | 22 | Language = System.Globalization.CultureInfo.CurrentCulture.IetfLanguageTag; 23 | 24 | // Language = "zh-CN"; 25 | 26 | // Register modules into DI container 27 | ServiceProvider.LoadModule(new MainModule()); 28 | 29 | // Load main view 30 | Views.Sign.SignWindow window = new Views.Sign.SignWindow(); 31 | App.Current.MainWindow = window; 32 | App.Current.MainWindow.Show(); 33 | 34 | } 35 | 36 | 37 | private static string language; 38 | 39 | public static string Language 40 | { 41 | get { return language; } 42 | set 43 | { 44 | if (language != value) 45 | { 46 | language = value; 47 | 48 | List dictionaryList = new List(); 49 | foreach (ResourceDictionary dictionary in Application.Current.Resources.MergedDictionaries) 50 | { 51 | dictionaryList.Add(dictionary); 52 | } 53 | string requestedLanguage = string.Format(@"/UiCore/Styles/Languages/String.{0}.xaml", Language); 54 | ResourceDictionary resourceDictionary = dictionaryList.FirstOrDefault(d => d.Source.OriginalString.Equals(requestedLanguage)); 55 | if (resourceDictionary == null) 56 | { 57 | requestedLanguage = @"/UiCore/Styles/Languages/String.zh-CN.xaml"; 58 | resourceDictionary = dictionaryList.FirstOrDefault(d => d.Source.OriginalString.Equals(requestedLanguage)); 59 | } 60 | if (resourceDictionary != null) 61 | { 62 | Application.Current.Resources.MergedDictionaries.Remove(resourceDictionary); 63 | Application.Current.Resources.MergedDictionaries.Add(resourceDictionary); 64 | } 65 | 66 | 67 | 68 | 69 | } 70 | } 71 | } 72 | 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Deamon.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | netcoreapp3.1 6 | true 7 | wemove.ico 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | System.Windows.Interactivity.dll 22 | 23 | 24 | 25 | 26 | 27 | Never 28 | 29 | 30 | 31 | 32 | 33 | Code 34 | 35 | 36 | 37 | 38 | 39 | Designer 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Deamon.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | false 5 | 6 | 7 | 8 | Designer 9 | 10 | 11 | 12 | 13 | Code 14 | 15 | 16 | Code 17 | 18 | 19 | Code 20 | 21 | 22 | Code 23 | 24 | 25 | Code 26 | 27 | 28 | Code 29 | 30 | 31 | Code 32 | 33 | 34 | 35 | 36 | Designer 37 | 38 | 39 | Designer 40 | 41 | 42 | Designer 43 | 44 | 45 | Designer 46 | 47 | 48 | Designer 49 | 50 | 51 | Designer 52 | 53 | 54 | Designer 55 | 56 | 57 | Designer 58 | 59 | 60 | Designer 61 | 62 | 63 | Designer 64 | 65 | 66 | Designer 67 | 68 | 69 | Designer 70 | 71 | 72 | Designer 73 | 74 | 75 | Designer 76 | 77 | 78 | Designer 79 | 80 | 81 | Designer 82 | 83 | 84 | Designer 85 | 86 | 87 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Models/MainModule.cs: -------------------------------------------------------------------------------- 1 | using Deamon.ViewModels; 2 | using Deamon.ViewModels.Sign; 3 | using Deamon.Views.Sign; 4 | using Melphi.Base; 5 | using Melphi.IconSet; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Text; 9 | 10 | namespace Deamon.Models 11 | { 12 | public class MainModule : IModule 13 | { 14 | /// 15 | /// Register module into DI container 16 | /// 17 | /// 18 | public void OnLoad(IBinder binder) 19 | { 20 | 21 | binder.Bind(); 22 | 23 | binder.BindSingleton(); 24 | 25 | binder.BindSingleton(); 26 | 27 | binder.BindSingleton(); 28 | 29 | binder.BindSingleton(); 30 | 31 | binder.BindSingleton(); 32 | 33 | binder.BindSingleton(); 34 | 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/ServiceLocator.cs: -------------------------------------------------------------------------------- 1 | using Deamon.ViewModels; 2 | using Deamon.ViewModels.Sign; 3 | using Melphi.Base; 4 | using Melphi.IconSet; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace Deamon 10 | { 11 | public class ServiceLocator 12 | { 13 | public IIconSet IconSource => ServiceProvider.Get(); 14 | public MaterialSet MaterialSet => ServiceProvider.Get(); 15 | 16 | 17 | public MainViewModel MainViewModel => ServiceProvider.Get(); 18 | public SignViewModel SignViewModel => ServiceProvider.Get(); 19 | public SignInMailViewModel SignInMailViewModel => ServiceProvider.Get(); 20 | public SignInPassViewModel SignInPassViewModel => ServiceProvider.Get(); 21 | public SignUpViewModel SignUpViewModel => ServiceProvider.Get(); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mefdeamon/Desktop-WeMove/b1ad5cffcdbba639416e0dd0b32f8c3b7688eadf/src/Melphily200329.WeMove/Deamon/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Themes/DefaultStyles.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #FF053f4b 12 | 13 | #FF290736 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/AttachedProperties/BaseAttachedProperty.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | 6 | namespace Deamon.UiCore.AttachedProperties 7 | { 8 | /// 9 | /// A base attached property to replace the vanilla WPF attached property 10 | /// 11 | /// The parent class to be the attached property 12 | /// The type of this attached property 13 | public abstract class BaseAttachedProperty 14 | where TParent : new() 15 | { 16 | #region Public Events 17 | 18 | /// 19 | /// Fired when the value changes 20 | /// 21 | public event Action ValueChanged = (sender, e) => { }; 22 | 23 | /// 24 | /// Fired when the value changes, even when the value is the same 25 | /// 26 | public event Action ValueUpdated = (sender, value) => { }; 27 | 28 | #endregion 29 | 30 | #region Public Properties 31 | 32 | /// 33 | /// A singleton instance of our parent class 34 | /// 35 | public static TParent Instance { get; private set; } = new TParent(); 36 | 37 | #endregion 38 | 39 | #region Attached Property Definitions 40 | 41 | /// 42 | /// The attached property for this class 43 | /// 44 | public static readonly DependencyProperty ValueProperty = DependencyProperty.RegisterAttached( 45 | "Value", 46 | typeof(TProperty), 47 | typeof(BaseAttachedProperty), 48 | new UIPropertyMetadata( 49 | default(TProperty), 50 | new PropertyChangedCallback(OnValuePropertyChanged), 51 | new CoerceValueCallback(OnValuePropertyUpdated) 52 | )); 53 | 54 | /// 55 | /// The callback event when the is changed 56 | /// 57 | /// The UI element that had it's property changed 58 | /// The arguments for the event 59 | private static void OnValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 60 | { 61 | // Call the parent function 62 | (Instance as BaseAttachedProperty)?.OnValueChanged(d, e); 63 | 64 | // Call event listeners 65 | (Instance as BaseAttachedProperty)?.ValueChanged(d, e); 66 | } 67 | 68 | /// 69 | /// The callback event when the is changed, even if it is the same value 70 | /// 71 | /// The UI element that had it's property changed 72 | /// The arguments for the event 73 | private static object OnValuePropertyUpdated(DependencyObject d, object value) 74 | { 75 | // Call the parent function 76 | (Instance as BaseAttachedProperty)?.OnValueUpdated(d, value); 77 | 78 | // Call event listeners 79 | (Instance as BaseAttachedProperty)?.ValueUpdated(d, value); 80 | 81 | // Return the value 82 | return value; 83 | } 84 | 85 | /// 86 | /// Gets the attached property 87 | /// 88 | /// The element to get the property from 89 | /// 90 | public static TProperty GetValue(DependencyObject d) => (TProperty)d.GetValue(ValueProperty); 91 | 92 | /// 93 | /// Sets the attached property 94 | /// 95 | /// The element to get the property from 96 | /// The value to set the property to 97 | public static void SetValue(DependencyObject d, TProperty value) => d.SetValue(ValueProperty, value); 98 | 99 | #endregion 100 | 101 | #region Event Methods 102 | 103 | /// 104 | /// The method that is called when any attached property of this type is changed 105 | /// 106 | /// The UI element that this property was changed for 107 | /// The arguments for this event 108 | public virtual void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { } 109 | 110 | /// 111 | /// The method that is called when any attached property of this type is changed, even if the value is the same 112 | /// 113 | /// The UI element that this property was changed for 114 | /// The arguments for this event 115 | public virtual void OnValueUpdated(DependencyObject sender, object value) { } 116 | 117 | #endregion 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/AttachedProperties/IsBusyProperty.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Deamon.UiCore.AttachedProperties 6 | { 7 | public class IsBusyProperty : BaseAttachedProperty 8 | { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/AttachedProperties/IsFocusedProperty.cs: -------------------------------------------------------------------------------- 1 | #region Deamon 2 | // the app's classes of wemove project 3 | #endregion 4 | 5 | using System.Reflection; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Controls.Primitives; 9 | 10 | namespace Deamon.UiCore.AttachedProperties 11 | { 12 | /// 13 | /// Focuses (keyboard focus) this element on load 14 | /// 15 | public class IsFocusedProperty : BaseAttachedProperty 16 | { 17 | public override void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) 18 | { 19 | // If we don't have a control, return 20 | if (!(sender is Control control)) 21 | return; 22 | 23 | // If TextBox has content default, set the cursor 24 | if (sender is TextBox textBox) 25 | { 26 | // Set the cursor at the end of the last character 27 | textBox.TextChanged += (s, e) => textBox.SelectionStart = textBox.Text.Length; ; 28 | } 29 | 30 | // If PasswordBox has content default, set the cursor 31 | if (sender is PasswordBox passwordBox) 32 | { 33 | // Set the cursor at the end of the last character 34 | passwordBox.PasswordChanged += (s, e) => passwordBox.GetType() 35 | .GetMethod("Select", BindingFlags.Instance | BindingFlags.NonPublic) 36 | .Invoke(passwordBox, new object[] { passwordBox.Password.Length, passwordBox.Password.Length }); 37 | } 38 | 39 | // Focus this control once loaded 40 | control.Loaded += (s, se) => control.Focus(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/AttachedProperties/IsMaximizedProperty.cs: -------------------------------------------------------------------------------- 1 | #region Deamon 2 | // the app's classes of wemove project 3 | #endregion 4 | 5 | namespace Deamon.UiCore.AttachedProperties 6 | { 7 | /// 8 | /// If true the window's state is Maximize 9 | /// If false the window's state isn't Maximize 10 | /// 11 | public class IsMaximizedProperty : BaseAttachedProperty 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/AttachedProperties/PasswordProperties.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | namespace Deamon.UiCore.AttachedProperties 8 | { 9 | public class BoundPasswordProperty : BaseAttachedProperty 10 | { 11 | public override void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) 12 | { 13 | PasswordBox box = sender as PasswordBox; 14 | 15 | if (box == null) 16 | { 17 | return; 18 | } 19 | 20 | box.PasswordChanged += Box_PasswordChanged; 21 | 22 | if (!UpdatingProperty.GetValue(sender)) 23 | box.Password = e.NewValue.ToString(); 24 | 25 | box.PasswordChanged -= Box_PasswordChanged; 26 | } 27 | 28 | private void Box_PasswordChanged(object sender, RoutedEventArgs e) 29 | { 30 | PasswordBox box = sender as PasswordBox; 31 | 32 | box.SetValue(UpdatingProperty.ValueProperty, true); 33 | box.SetValue(ValueProperty, box.Password); 34 | box.SetValue(UpdatingProperty.ValueProperty, false); 35 | } 36 | } 37 | 38 | public class NeedCaptureProperty : BaseAttachedProperty 39 | { 40 | public override void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) 41 | { 42 | PasswordBox box = sender as PasswordBox; 43 | 44 | if (box == null) 45 | { 46 | return; 47 | } 48 | 49 | if ((bool)e.OldValue) 50 | { 51 | box.PasswordChanged -= Box_PasswordChanged; 52 | } 53 | 54 | if ((bool)e.NewValue) 55 | { 56 | box.PasswordChanged += Box_PasswordChanged; 57 | HasPasswordProperty.SetValue(box); 58 | } 59 | } 60 | 61 | private void Box_PasswordChanged(object sender, RoutedEventArgs e) 62 | { 63 | PasswordBox box = sender as PasswordBox; 64 | 65 | box.SetValue(UpdatingProperty.ValueProperty, true); 66 | box.SetValue(BoundPasswordProperty.ValueProperty, box.Password); 67 | box.SetValue(UpdatingProperty.ValueProperty, false); 68 | 69 | HasPasswordProperty.SetValue(box); 70 | } 71 | } 72 | 73 | public class HasPasswordProperty : BaseAttachedProperty 74 | { 75 | public static void SetValue(DependencyObject sender) 76 | { 77 | SetValue(sender, (sender as PasswordBox).SecurePassword.Length > 0); 78 | } 79 | } 80 | 81 | public class UpdatingProperty : BaseAttachedProperty 82 | { 83 | 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/CommonHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Text.RegularExpressions; 5 | 6 | namespace Deamon.UiCore 7 | { 8 | public static class CommonHelper 9 | { 10 | /// 11 | /// 是邮箱 12 | /// 13 | /// 14 | /// 15 | public static bool IsEmail(this string source) 16 | { 17 | return Regex.IsMatch(source, @"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$", RegexOptions.IgnoreCase); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/Controls/CommandControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Data; 7 | using System.Windows.Documents; 8 | using System.Windows.Input; 9 | using System.Windows.Media; 10 | using System.Windows.Media.Imaging; 11 | using System.Windows.Navigation; 12 | using System.Windows.Shapes; 13 | 14 | namespace Deamon.UiCore.Controls 15 | { 16 | 17 | public class CommandControl : ContentControl 18 | { 19 | static CommandControl() 20 | { 21 | DefaultStyleKeyProperty.OverrideMetadata(typeof(CommandControl), new FrameworkPropertyMetadata(typeof(CommandControl))); 22 | } 23 | public CommandControl() 24 | { 25 | MouseLeftButtonDown += CommandControlCC_MouseLeftButtonDown; 26 | } 27 | 28 | private void CommandControlCC_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) 29 | { 30 | if (Command != null) 31 | { 32 | if (Command.CanExecute(CommandParameter)) 33 | { 34 | Command.Execute(CommandParameter); 35 | } 36 | } 37 | } 38 | 39 | private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs mouseButtonEventArgs) 40 | { 41 | if (Command != null) 42 | { 43 | if (Command.CanExecute(CommandParameter)) 44 | { 45 | Command.Execute(CommandParameter); 46 | } 47 | } 48 | } 49 | 50 | public static readonly DependencyProperty CommandProperty = 51 | DependencyProperty.Register("Command", typeof(ICommand), 52 | typeof(CommandControl), 53 | new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None)); 54 | 55 | public ICommand Command 56 | { 57 | get { return (ICommand)GetValue(CommandProperty); } 58 | set { SetValue(CommandProperty, value); } 59 | } 60 | 61 | public static readonly DependencyProperty CommandParameterProperty = 62 | DependencyProperty.Register("CommandParameter", typeof(object), 63 | typeof(CommandControl), 64 | new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None)); 65 | 66 | public object CommandParameter 67 | { 68 | get { return (object)GetValue(CommandParameterProperty); } 69 | set { SetValue(CommandParameterProperty, value); } 70 | } 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/Controls/IconButton.cs: -------------------------------------------------------------------------------- 1 | #region Deamon 2 | // the app's classes of wemove project 3 | #endregion 4 | 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Media; 8 | 9 | namespace Deamon.UiCore.Controls 10 | { 11 | /// 12 | /// The button with a icon 13 | /// 14 | public class IconButton : Button 15 | { 16 | public IconButton() 17 | { 18 | DefaultStyleKey = typeof(IconButton); 19 | } 20 | 21 | /// 22 | /// The icon geometry data 23 | /// 24 | public Geometry IconData 25 | { 26 | get => (Geometry)GetValue(IconDataProperty); 27 | set => SetValue(IconDataProperty, value); 28 | } 29 | 30 | /// 31 | /// 32 | /// 33 | public static readonly DependencyProperty IconDataProperty = DependencyProperty.Register(nameof(IconData), typeof(Geometry), typeof(IconButton)); 34 | 35 | 36 | /// 37 | /// Rotate Transform Angle 38 | /// 39 | public double RotateAngle 40 | { 41 | get { return (double)GetValue(RotateAngleProperty); } 42 | set { SetValue(RotateAngleProperty, value); } 43 | } 44 | 45 | /// 46 | /// 47 | /// 48 | public static readonly DependencyProperty RotateAngleProperty = 49 | DependencyProperty.Register(nameof(RotateAngle), typeof(double), typeof(IconButton), new PropertyMetadata(default(double))); 50 | 51 | 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/Styles/CheckBoxs.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 63 | 64 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/Styles/IconButtons.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 79 | 80 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/Styles/Languages/String.en-US.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | Close 6 | Minimize 7 | Restore 8 | Maximum 9 | Enter email 10 | Enter password 11 | Remember me 12 | Next 13 | Create a new user 14 | Back Email verification 15 | Enter name 16 | 17 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/Styles/Languages/String.zh-CN.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 关闭 6 | 最小化 7 | 窗口化 8 | 最大化 9 | 请输入电子邮件 10 | 请输入密码 11 | 记住我 12 | 下一步 13 | 创建一个新用户 14 | 回到邮箱验证 15 | 请输入昵称 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/Styles/TextBoxs.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 146 | 147 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/ValueConverters/BooleanToObjectConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows.Data; 5 | 6 | namespace Deamon.UiCore.ValueConverters 7 | { 8 | /// 9 | /// 将布尔值转换成其他类型,需要提供两个 Object 类型的真值和假值 10 | /// 11 | public class BooleanToObjectConverter : IValueConverter 12 | { 13 | public object FalseValue { get; set; } 14 | public object TrueValue { get; set; } 15 | 16 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 17 | { 18 | // 没有参数的情况下是正向的,T-T F-F 19 | if (parameter == null) 20 | return Equals(value, true) ? TrueValue : FalseValue; 21 | // 有参数的情况下是反向的, T-F F-T 22 | else 23 | return Equals(value, true) ? FalseValue : TrueValue; 24 | } 25 | 26 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 27 | { 28 | return Equals(value, TrueValue) ? true : Equals(value, FalseValue) ? false : (bool?)null; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/UiCore/ValueConverters/ValueConverter.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | Visible 6 | Collapsed 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/ViewModels/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | #region Deamon 2 | // the app's classes of wemove project 3 | #endregion 4 | 5 | using System.Windows; 6 | 7 | namespace Deamon.ViewModels 8 | { 9 | public class MainViewModel : BaseWindowModel 10 | { 11 | 12 | /// 13 | /// 默认构造函数 14 | /// 15 | public MainViewModel(Window window) : base(window) 16 | { 17 | 18 | } 19 | 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/ViewModels/Sign/BaseSignInViewModel.cs: -------------------------------------------------------------------------------- 1 | #region Deamon 2 | // the app's classes of wemove project 3 | #endregion 4 | 5 | using Melphi.Base; 6 | using System.Threading.Tasks; 7 | using System.Windows.Input; 8 | 9 | namespace Deamon.ViewModels.Sign 10 | { 11 | /// 12 | /// The base class of sign in information verification 13 | /// 14 | public abstract class BaseSignInViewModel : NotifyPropertyChanged 15 | { 16 | private bool hasError = false; 17 | 18 | /// 19 | /// has a error occured 20 | /// 21 | public bool HasError 22 | { 23 | get { return hasError; } 24 | set { hasError = value; OnPropertyChanged(); } 25 | } 26 | 27 | private string errorMessage = ""; 28 | 29 | /// 30 | /// the error message 31 | /// 32 | public string ErrorMessage 33 | { 34 | get { return errorMessage; } 35 | set { errorMessage = value; OnPropertyChanged(); } 36 | } 37 | 38 | private bool needRemember; 39 | 40 | /// 41 | /// Remember this input and fill in automatically next time 42 | /// 43 | public bool NeedRemember 44 | { 45 | get { return needRemember; } 46 | set { needRemember = value; OnPropertyChanged(); } 47 | } 48 | 49 | private bool canSign; 50 | 51 | /// 52 | /// Is ture U Can Sign In 53 | /// 54 | public bool CanSign 55 | { 56 | get { return canSign; } 57 | set { canSign = value; OnPropertyChanged(); } 58 | } 59 | 60 | private bool isSigning; 61 | 62 | /// 63 | /// Show the status of Sign Button is Running or not 64 | /// 65 | public bool IsSigning 66 | { 67 | get { return isSigning; } 68 | set { isSigning = value; OnPropertyChanged(); } 69 | } 70 | 71 | /// 72 | /// Validate the command 73 | /// 74 | public abstract ICommand SignCommand { get; set; } 75 | 76 | /// 77 | /// Skip to other (like SignUp or SignInEmail) page command 78 | /// 79 | public abstract ICommand GotoCommand { get; set; } 80 | 81 | /// 82 | /// Wait for a while, then erase the error message display 83 | /// 84 | /// The number of milliseconds to wait 85 | protected void WipeErrorAffterMS(int ms = 2000) 86 | { 87 | Task.Run(() => 88 | { 89 | System.Threading.Thread.Sleep(ms); 90 | ErrorMessage = ""; 91 | HasError = false; 92 | }); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/ViewModels/Sign/SignInMailViewModel.cs: -------------------------------------------------------------------------------- 1 | #region Deamon 2 | // the app's classes of wemove project 3 | #endregion 4 | 5 | using Deamon.UiCore; 6 | using Melphi.Base; 7 | using System; 8 | using System.Net.Http; 9 | using System.Text; 10 | using System.Text.Json; 11 | using System.Threading.Tasks; 12 | using System.Windows.Input; 13 | using static Deamon.ViewModels.Sign.SignUpViewModel; 14 | 15 | namespace Deamon.ViewModels.Sign 16 | { 17 | public class SignInMailViewModel : BaseSignInViewModel 18 | { 19 | 20 | /// 21 | /// Default constructor 22 | /// 23 | public SignInMailViewModel() 24 | { 25 | SignCommand = new RelayCommand(async () => 26 | { 27 | await RunCommandAsync(() => IsSigning, async () => 28 | { 29 | await Sign(); 30 | }); 31 | }); 32 | GotoCommand = new RelayCommand(() => 33 | { 34 | ServiceProvider.Get().CurrentViewType = SignViewType.SignUp; 35 | }); 36 | 37 | Email = "mel@wem.com"; 38 | } 39 | 40 | private string email; 41 | 42 | public string Email 43 | { 44 | get { return email; } 45 | set 46 | { 47 | email = value; OnPropertyChanged(); 48 | CanSign = !string.IsNullOrWhiteSpace(email); 49 | } 50 | } 51 | 52 | public override ICommand SignCommand { get; set; } 53 | public override ICommand GotoCommand { get; set; } 54 | 55 | /// 56 | /// Email verification 57 | /// 58 | /// 59 | private async Task Sign() 60 | { 61 | // 输入邮箱格式校验 62 | if (!Email.IsEmail()) 63 | { 64 | ErrorMessage = "错误!邮箱格式不正确,请重试!"; 65 | HasError = true; 66 | WipeErrorAffterMS(); 67 | return; 68 | } 69 | 70 | var http = "http://localhost:5000"; 71 | var api = "/api/auth/sign-in-email"; 72 | var requestUrl = http + api; 73 | 74 | using (var client = new HttpClient()) 75 | { 76 | var postData = new 77 | { 78 | Email = email, 79 | Password = "" 80 | }; 81 | var json = JsonSerializer.Serialize(postData); 82 | var content = new StringContent(json, Encoding.UTF8, "application/json"); 83 | HttpResponseMessage response = null; 84 | try 85 | { 86 | response = await client.PostAsync(requestUrl, content); 87 | } 88 | catch (Exception ex) 89 | { 90 | ErrorMessage = ex.Message; 91 | HasError = true; 92 | WipeErrorAffterMS(); 93 | return; 94 | } 95 | 96 | if (response.IsSuccessStatusCode) 97 | { 98 | App.Current.Dispatcher.Invoke(() => ServiceProvider.Get().CurrentViewType = SignViewType.SignInPass); 99 | } 100 | else 101 | { 102 | var contentString = await response.Content.ReadAsStringAsync(); 103 | ApiResponse apiResponse = null; 104 | try 105 | { 106 | apiResponse = JsonSerializer.Deserialize(contentString); 107 | ErrorMessage = apiResponse == null ? "response content json deserialize error" : apiResponse.message; 108 | } 109 | catch (Exception ex) 110 | { 111 | ErrorMessage = ex.Message; 112 | } 113 | 114 | HasError = true; 115 | WipeErrorAffterMS(); 116 | return; 117 | } 118 | } 119 | } 120 | } 121 | 122 | public class ApiResponse 123 | { 124 | public string message { get; set; } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/ViewModels/Sign/SignInPassViewModel.cs: -------------------------------------------------------------------------------- 1 | #region Deamon 2 | // the app's classes of wemove project 3 | #endregion 4 | 5 | using Melphi.Base; 6 | using System; 7 | using System.Net.Http; 8 | using System.Text.Json; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows; 12 | using System.Windows.Input; 13 | 14 | namespace Deamon.ViewModels.Sign 15 | { 16 | public class SignInPassViewModel : BaseSignInViewModel 17 | { 18 | /// 19 | /// Default constructor 20 | /// 21 | public SignInPassViewModel() 22 | { 23 | SignCommand = new RelayCommand(async () => 24 | { 25 | await RunCommandAsync(() => IsSigning, async () => 26 | { 27 | //App.Current.Dispatcher.Invoke(() => ServiceProvider.Get().CurrentView = new Views.Sign.SignLoadingView()); 28 | await SignIn(); 29 | }); 30 | }); 31 | GotoCommand = new RelayCommand(() => 32 | { 33 | ServiceProvider.Get().CurrentViewType = SignViewType.SignInMail; 34 | }); 35 | 36 | Password = "deamon"; 37 | } 38 | 39 | private string password; 40 | 41 | /// 42 | /// Password 43 | /// 44 | public string Password 45 | { 46 | get { return password; } 47 | set 48 | { 49 | password = value; OnPropertyChanged(); 50 | CanSign = !string.IsNullOrWhiteSpace(password); 51 | } 52 | } 53 | 54 | public override ICommand SignCommand { get; set; } 55 | public override ICommand GotoCommand { get; set; } 56 | 57 | /// 58 | /// Password verification 59 | /// 60 | /// 61 | private async Task SignIn() 62 | { 63 | if (password.Length < 6) 64 | { 65 | ErrorMessage = "错误!邮箱格式不正确,请重试!"; 66 | HasError = true; 67 | WipeErrorAffterMS(); 68 | return; 69 | } 70 | 71 | var http = "http://localhost:5000"; 72 | var api = "/api/auth/sign-in-password"; 73 | var requestUrl = http + api; 74 | 75 | using (var client = new HttpClient()) 76 | { 77 | var postData = new 78 | { 79 | Email = ServiceProvider.Get().Email, 80 | Password = password 81 | }; 82 | var json = JsonSerializer.Serialize(postData); 83 | var content = new StringContent(json, Encoding.UTF8, "application/json"); 84 | HttpResponseMessage response = null; 85 | try 86 | { 87 | response = await client.PostAsync(requestUrl, content); 88 | } 89 | catch (Exception ex) 90 | { 91 | ErrorMessage = ex.Message; 92 | HasError = true; 93 | WipeErrorAffterMS(); 94 | return; 95 | } 96 | 97 | if (response.IsSuccessStatusCode) 98 | { 99 | // start up main window 100 | App.Current.Dispatcher.Invoke(() => 101 | { 102 | Window window = App.Current.MainWindow; 103 | App.Current.MainWindow = new Views.MainWindow(); 104 | window.Close(); 105 | App.Current.MainWindow.Show(); 106 | }); 107 | } 108 | else 109 | { 110 | var contentString = await response.Content.ReadAsStringAsync(); 111 | ApiResponse apiResponse = null; 112 | try 113 | { 114 | apiResponse = JsonSerializer.Deserialize(contentString); 115 | ErrorMessage = apiResponse == null ? "response content json deserialize error" : apiResponse.message; 116 | } 117 | catch (Exception ex) 118 | { 119 | ErrorMessage = ex.Message; 120 | } 121 | 122 | HasError = true; 123 | WipeErrorAffterMS(); 124 | return; 125 | } 126 | } 127 | } 128 | 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/ViewModels/Sign/SignUpViewModel.cs: -------------------------------------------------------------------------------- 1 | #region Deamon 2 | // the app's classes of wemove project 3 | #endregion 4 | 5 | using Deamon.UiCore; 6 | using Melphi.Base; 7 | using System.Net.Http; 8 | using System.Text.Json; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Input; 12 | using System.Windows; 13 | using System; 14 | 15 | namespace Deamon.ViewModels.Sign 16 | { 17 | public class SignUpViewModel : BaseSignInViewModel 18 | { 19 | 20 | /// 21 | /// Default constructor 22 | /// 23 | public SignUpViewModel() 24 | { 25 | SignCommand = new RelayCommand(async () => 26 | { 27 | await RunCommandAsync(() => IsSigning, async () => 28 | { 29 | await Sign(); 30 | }); 31 | }); 32 | GotoCommand = new RelayCommand(() => 33 | { 34 | ServiceProvider.Get().CurrentViewType = SignViewType.SignInMail; 35 | }); 36 | 37 | Email = "mel@wem.com"; 38 | 39 | Username = "Lymehu"; 40 | Password = ""; 41 | } 42 | 43 | private string email; 44 | 45 | public string Email 46 | { 47 | get { return email; } 48 | set 49 | { 50 | email = value; OnPropertyChanged(); 51 | CanSign = !string.IsNullOrWhiteSpace(email); 52 | } 53 | } 54 | 55 | private string password; 56 | 57 | /// 58 | /// Password 59 | /// 60 | public string Password 61 | { 62 | get { return password; } 63 | set 64 | { 65 | password = value; OnPropertyChanged(); 66 | CanSign = !string.IsNullOrWhiteSpace(password); 67 | } 68 | } 69 | 70 | 71 | private string username; 72 | 73 | public string Username 74 | { 75 | get { return username; } 76 | set { Set(ref username, value); } 77 | } 78 | 79 | 80 | 81 | public override ICommand SignCommand { get; set; } 82 | public override ICommand GotoCommand { get; set; } 83 | 84 | /// 85 | /// Email verification 86 | /// 87 | /// 88 | private async Task Sign() 89 | { 90 | // 输入邮箱格式校验 91 | if (!Email.IsEmail()) 92 | { 93 | ErrorMessage = "错误!邮箱格式不正确,请重试!"; 94 | HasError = true; 95 | WipeErrorAffterMS(); 96 | return; 97 | } 98 | 99 | var http = "http://localhost:5000"; 100 | var api = "/api/auth/sign-up"; 101 | var requestUrl = http + api; 102 | 103 | using (var client = new HttpClient()) 104 | { 105 | var postData = new 106 | { 107 | Email = email, 108 | UserName = username, 109 | Password = password 110 | }; 111 | var json = JsonSerializer.Serialize(postData); 112 | var content = new StringContent(json, Encoding.UTF8, "application/json"); 113 | HttpResponseMessage response = null; 114 | try 115 | { 116 | response = await client.PostAsync(requestUrl, content); 117 | } 118 | catch (Exception ex) 119 | { 120 | ErrorMessage = ex.Message; 121 | HasError = true; 122 | WipeErrorAffterMS(); 123 | return; 124 | } 125 | 126 | if (response.IsSuccessStatusCode) 127 | { 128 | // start up main window 129 | App.Current.Dispatcher.Invoke(() => 130 | { 131 | Window window = App.Current.MainWindow; 132 | App.Current.MainWindow = new Views.MainWindow(); 133 | window.Close(); 134 | App.Current.MainWindow.Show(); 135 | }); 136 | } 137 | else 138 | { 139 | var contentString = await response.Content.ReadAsStringAsync(); 140 | ApiResponse apiResponse = null; 141 | try 142 | { 143 | apiResponse = JsonSerializer.Deserialize(contentString); 144 | ErrorMessage = apiResponse == null ? "response content json deserialize error" : apiResponse.message; 145 | } 146 | catch (Exception ex) 147 | { 148 | ErrorMessage = ex.Message; 149 | } 150 | 151 | HasError = true; 152 | WipeErrorAffterMS(); 153 | return; 154 | } 155 | } 156 | } 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/ViewModels/Sign/SignViewModel.cs: -------------------------------------------------------------------------------- 1 | using Deamon.Views.Sign; 2 | using Melphi.Base; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Input; 8 | 9 | namespace Deamon.ViewModels.Sign 10 | { 11 | 12 | public enum SignViewType 13 | { 14 | None, 15 | SignInMail, 16 | SignInPass, 17 | SignUp 18 | } 19 | 20 | public class SignViewModel : NotifyPropertyChanged 21 | { 22 | 23 | private SignViewType currentViewType; 24 | 25 | public SignViewType CurrentViewType 26 | { 27 | get { return currentViewType; } 28 | set 29 | { 30 | if (Set(ref currentViewType, value)) 31 | { 32 | switch (currentViewType) 33 | { 34 | case SignViewType.SignInMail: 35 | CurrentView = ServiceProvider.Get(); 36 | WindowHeight = 462; 37 | break; 38 | case SignViewType.SignInPass: 39 | CurrentView = ServiceProvider.Get(); 40 | WindowHeight = 462; 41 | break; 42 | case SignViewType.SignUp: 43 | CurrentView = ServiceProvider.Get() ; 44 | WindowHeight = 562; 45 | break; 46 | default: 47 | break; 48 | } 49 | } 50 | } 51 | } 52 | 53 | 54 | /// 55 | /// 默认构造函数 56 | /// 57 | public SignViewModel() 58 | { 59 | MinimCommand = new RelayCommand(() => 60 | { 61 | App.Current.MainWindow.WindowState = WindowState.Minimized; 62 | }); 63 | 64 | CloseCommand = new RelayCommand(() => 65 | { 66 | App.Current.MainWindow.Close(); 67 | }); 68 | 69 | CurrentViewType = SignViewType.SignInMail; 70 | } 71 | 72 | private FrameworkElement currentView; 73 | 74 | public FrameworkElement CurrentView 75 | { 76 | get { return currentView; } 77 | private set { currentView = value; OnPropertyChanged(); } 78 | } 79 | 80 | 81 | private double windowHeight = 462; 82 | 83 | public double WindowHeight 84 | { 85 | get { return windowHeight; } 86 | set { Set(ref windowHeight, value); } 87 | } 88 | 89 | public ICommand MinimCommand { get; private set; } 90 | public ICommand CloseCommand { get; private set; } 91 | 92 | 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Views/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using Deamon.ViewModels; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace Deamon.Views 18 | { 19 | /// 20 | /// Interaction logic for MainWindow.xaml 21 | /// 22 | public partial class MainWindow : Window 23 | { 24 | public MainWindow() 25 | { 26 | InitializeComponent(); 27 | 28 | DataContext = new MainViewModel(this); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Views/SearchView.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 41 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 71 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 85 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Views/SearchView.xaml.cs: -------------------------------------------------------------------------------- 1 | using Deamon.Models; 2 | using Melphi.Base; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | using System.Linq; 7 | using System.Reflection; 8 | using System.Text; 9 | using System.Windows; 10 | using System.Windows.Controls; 11 | 12 | namespace Deamon.Views 13 | { 14 | /// 15 | /// SearchView.xaml 的交互逻辑 16 | /// 17 | public partial class SearchView : UserControl 18 | { 19 | public SearchView() 20 | { 21 | InitializeComponent(); 22 | DataContext = new SearchViewModel(); 23 | } 24 | } 25 | public class IconModel 26 | { 27 | public string IconName { get; set; } 28 | 29 | public string IconData { get; set; } 30 | } 31 | 32 | public class SearchViewModel : NotifyPropertyChanged 33 | { 34 | /// 35 | /// 本地服务对象 36 | /// 37 | ServiceLocator Locator = new ServiceLocator(); 38 | 39 | /// 40 | /// 默认构造函数 41 | /// 42 | public SearchViewModel() 43 | { 44 | SearchCommand = new RelayCommand(() => 45 | { 46 | MessageBox.Show(SearchText); 47 | }); 48 | 49 | ChooseCommand = new RelayCommand(t => 50 | { 51 | SelectedIcon = t; 52 | }); 53 | 54 | 55 | 56 | // 初始化数据源 57 | var list = FindDititsInfo(Locator.IconSource); 58 | OriginalIcons = list; 59 | 60 | // 初始化界面 61 | SearchText = ""; 62 | } 63 | 64 | /// 65 | /// 原始数据 66 | /// 67 | IEnumerable OriginalIcons; 68 | 69 | 70 | private string searchText; 71 | 72 | /// 73 | /// 当前搜索文本 74 | /// 75 | public string SearchText 76 | { 77 | get { return searchText; } 78 | set 79 | { 80 | searchText = value; 81 | RaisePropertyChanged(nameof(SearchText)); 82 | OnSearchTextChanged(); 83 | } 84 | } 85 | 86 | /// 87 | /// 当搜索文本发生变化时,修改搜索匹配的图标集合 88 | /// 89 | private void OnSearchTextChanged() 90 | { 91 | if (string.IsNullOrWhiteSpace(SearchText)) 92 | { 93 | SearchedIcons = new ObservableCollection(OriginalIcons); 94 | return; 95 | } 96 | 97 | // 根据输入字符,检索原始数据中匹配的图标,并更新界面的绑定数据源 98 | SearchedIcons = new ObservableCollection(OriginalIcons.Where(t => t.IconName.ToLowerInvariant().Contains(SearchText.ToLowerInvariant()))); 99 | } 100 | 101 | 102 | private ObservableCollection searchedIcons; 103 | 104 | /// 105 | /// 当前搜索匹配的图标集合 106 | /// 107 | public ObservableCollection SearchedIcons 108 | 109 | { 110 | get { return searchedIcons; } 111 | set 112 | { 113 | Set(ref searchedIcons, value); 114 | } 115 | } 116 | 117 | private IconModel selectedIcon; 118 | 119 | /// 120 | /// 当前选中的图标 121 | /// 122 | public IconModel SelectedIcon 123 | { 124 | get { return selectedIcon; } 125 | set { selectedIcon = value; OnPropertyChanged(); } 126 | } 127 | 128 | 129 | /// 130 | /// 搜索命令 131 | /// 132 | public RelayCommand SearchCommand { get; private set; } 133 | 134 | 135 | /// 136 | /// 选中命令 137 | /// 138 | public RelayCommand ChooseCommand { get; private set; } 139 | 140 | 141 | 142 | 143 | /// 144 | /// 获取 model 对象中的属性信息 145 | /// 146 | /// 对象类型 147 | /// 对象 148 | /// 149 | List FindDititsInfo(T model) 150 | { 151 | List icons = new List(); 152 | var newType = model.GetType(); 153 | foreach (var item in newType.GetRuntimeProperties()) 154 | { 155 | IconModel icon = new IconModel(); 156 | icon.IconName = item.Name; 157 | icon.IconData = item.GetValue(model).ToString(); 158 | icons.Add(icon); 159 | } 160 | return icons; 161 | } 162 | 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Views/Sign/AnimatableBaseView.cs: -------------------------------------------------------------------------------- 1 | using Deamon.UiCore.Util; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Controls; 7 | 8 | namespace Deamon.Views.Sign 9 | { 10 | public class AnimatableBaseView : UserControl 11 | { 12 | 13 | public AnimationDirection LoadedAnimateDirection { get; set; } = AnimationDirection.FromLeft; 14 | 15 | public AnimationDirection UnLoadAnimateDirection { get; set; } = AnimationDirection.ToRight; 16 | 17 | public bool ShouldAnimatedOut { get; set; } = false; 18 | 19 | public AnimatableBaseView() 20 | { 21 | Loaded += AnimatableBaseView_Loaded; 22 | } 23 | 24 | private async void AnimatableBaseView_Loaded(object sender, System.Windows.RoutedEventArgs e) 25 | { 26 | if (ShouldAnimatedOut) 27 | await AddAnimationOut(); 28 | else 29 | await AddAnimationIn(); 30 | } 31 | 32 | private async Task AddAnimationIn() 33 | { 34 | await this.SlideAndFadeInAsync(LoadedAnimateDirection); 35 | } 36 | 37 | private async Task AddAnimationOut() 38 | { 39 | await this.SlideAndFadeOutAsync(UnLoadAnimateDirection); 40 | } 41 | } 42 | 43 | 44 | public enum AnimationDirection 45 | { 46 | None, 47 | FromLeft, 48 | FromRight, 49 | ToLeft, 50 | ToRight 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Views/Sign/SignHost.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Views/Sign/SignHost.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace Deamon.Views.Sign 16 | { 17 | /// 18 | /// SignHost.xaml 的交互逻辑 19 | /// 20 | public partial class SignHost : UserControl 21 | { 22 | public SignHost() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | 28 | public FrameworkElement CurrentViewContent 29 | { 30 | get { return (FrameworkElement)GetValue(CurrentViewContentProperty); } 31 | set { SetValue(CurrentViewContentProperty, value); } 32 | } 33 | 34 | // Using a DependencyProperty as the backing store for CurrentViewContent. This enables animation, styling, binding, etc... 35 | public static readonly DependencyProperty CurrentViewContentProperty = 36 | DependencyProperty.Register("CurrentViewContent", typeof(FrameworkElement), typeof(SignHost), new UIPropertyMetadata(default(FrameworkElement), null, CurrentViewPropertyChanged)); 37 | 38 | private static object CurrentViewPropertyChanged(DependencyObject d, object baseValue) 39 | { 40 | var oldFrame = (d as SignHost).OldFrame; 41 | var newFrame = (d as SignHost).NewFrame; 42 | 43 | var oldFrameContent = oldFrame.Content; 44 | var newFrameContent = newFrame.Content; 45 | 46 | if (newFrameContent is AnimatableBaseView animatableBaseView) 47 | { 48 | animatableBaseView.ShouldAnimatedOut = true; 49 | oldFrame.Content = newFrameContent; 50 | newFrame.Content = null; 51 | } 52 | // First time 53 | else 54 | { 55 | newFrame.Content = baseValue; 56 | return baseValue; 57 | } 58 | 59 | 60 | Task.Delay((int)(300)).ContinueWith((t) => 61 | { 62 | // set new content 63 | Application.Current.Dispatcher.Invoke(() =>newFrame.Content = baseValue); 64 | }); 65 | 66 | return baseValue; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Melphily200329.WeMove/Deamon/Views/Sign/SignInMailView.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |