├── .gitignore
├── Img_Share.sln
├── Img_Share
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── BadgeLogo.scale-100.png
│ ├── BadgeLogo.scale-125.png
│ ├── BadgeLogo.scale-150.png
│ ├── BadgeLogo.scale-200.png
│ ├── BadgeLogo.scale-400.png
│ ├── Dark.png
│ ├── LargeTile.scale-100.png
│ ├── LargeTile.scale-125.png
│ ├── LargeTile.scale-150.png
│ ├── LargeTile.scale-200.png
│ ├── LargeTile.scale-400.png
│ ├── Light.png
│ ├── LockScreenLogo.scale-200.png
│ ├── SmallTile.scale-100.png
│ ├── SmallTile.scale-125.png
│ ├── SmallTile.scale-150.png
│ ├── SmallTile.scale-200.png
│ ├── SmallTile.scale-400.png
│ ├── SplashScreen.scale-100.png
│ ├── SplashScreen.scale-125.png
│ ├── SplashScreen.scale-150.png
│ ├── SplashScreen.scale-200.png
│ ├── SplashScreen.scale-400.png
│ ├── Square150x150Logo.scale-100.png
│ ├── Square150x150Logo.scale-125.png
│ ├── Square150x150Logo.scale-150.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square150x150Logo.scale-400.png
│ ├── Square44x44Logo.altform-lightunplated_targetsize-16.png
│ ├── Square44x44Logo.altform-lightunplated_targetsize-24.png
│ ├── Square44x44Logo.altform-lightunplated_targetsize-256.png
│ ├── Square44x44Logo.altform-lightunplated_targetsize-32.png
│ ├── Square44x44Logo.altform-lightunplated_targetsize-48.png
│ ├── Square44x44Logo.altform-unplated_targetsize-16.png
│ ├── Square44x44Logo.altform-unplated_targetsize-256.png
│ ├── Square44x44Logo.altform-unplated_targetsize-32.png
│ ├── Square44x44Logo.altform-unplated_targetsize-48.png
│ ├── Square44x44Logo.scale-100.png
│ ├── Square44x44Logo.scale-125.png
│ ├── Square44x44Logo.scale-150.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.scale-400.png
│ ├── Square44x44Logo.targetsize-16.png
│ ├── Square44x44Logo.targetsize-24.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── Square44x44Logo.targetsize-256.png
│ ├── Square44x44Logo.targetsize-32.png
│ ├── Square44x44Logo.targetsize-48.png
│ ├── StoreLogo.backup.png
│ ├── StoreLogo.scale-100.png
│ ├── StoreLogo.scale-125.png
│ ├── StoreLogo.scale-150.png
│ ├── StoreLogo.scale-200.png
│ ├── StoreLogo.scale-400.png
│ ├── Wide310x150Logo.scale-100.png
│ ├── Wide310x150Logo.scale-125.png
│ ├── Wide310x150Logo.scale-150.png
│ ├── Wide310x150Logo.scale-200.png
│ ├── Wide310x150Logo.scale-400.png
│ ├── imgHolder_dark.png
│ └── imgHolder_light.png
├── Controls
│ ├── GroupMaskControl.xaml
│ ├── GroupMaskControl.xaml.cs
│ ├── HoldMaskTip.xaml
│ ├── HoldMaskTip.xaml.cs
│ ├── ImageMaskControl.xaml
│ ├── ImageMaskControl.xaml.cs
│ ├── MyImage.xaml
│ ├── MyImage.xaml.cs
│ ├── PopupMaskTip.xaml
│ ├── PopupMaskTip.xaml.cs
│ ├── SettingControl.xaml
│ └── SettingControl.xaml.cs
├── Dialogs
│ ├── AddGroupDialog.xaml
│ ├── AddGroupDialog.xaml.cs
│ ├── AuthKeyDialog.xaml
│ ├── AuthKeyDialog.xaml.cs
│ ├── GroupDialog.xaml
│ ├── GroupDialog.xaml.cs
│ ├── TipDialog.xaml
│ └── TipDialog.xaml.cs
├── Font
│ ├── FZLTCHJW.ttf
│ ├── PermanentMarker.ttf
│ └── ShareImg.ttf
├── ImgShare.db
├── Img_Share.csproj
├── Img_Share.csproj.user
├── Img_Share_TemporaryKey.pfx
├── Language
│ ├── en-US
│ │ └── Resources.resw
│ └── zh-CN
│ │ └── Resources.resw
├── MainPage.xaml
├── MainPage.xaml.cs
├── Model
│ ├── KeyValue.cs
│ └── ProgressStatus.cs
├── Package.StoreAssociation.xml
├── Package.appxmanifest
├── Pages
│ ├── LoginPage.xaml
│ ├── LoginPage.xaml.cs
│ ├── NetErrorPage.xaml
│ └── NetErrorPage.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── Template
│ ├── ControlTemplate.xaml
│ └── Text.xaml
└── Theme
│ ├── Dark.xaml
│ └── Light.xaml
├── LICENSE
├── OneDriveShareImage
├── Model
│ ├── ImageDbContext.cs
│ ├── OneDriveImage.cs
│ └── OneDriveImageGroup.cs
├── OneDriveShareImage.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ └── OneDriveShareImage.rd.xml
└── ShareImageTools.cs
├── README.md
└── Tools
├── AppSettings.cs
├── AppTools.cs
├── Properties
├── AssemblyInfo.cs
└── Tools.rd.xml
└── Tools.csproj
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | *.pfx
26 |
27 | # Visual Studio 2015 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # MSTest test Results
33 | [Tt]est[Rr]esult*/
34 | [Bb]uild[Ll]og.*
35 |
36 | # NUNIT
37 | *.VisualState.xml
38 | TestResult.xml
39 |
40 | # Build Results of an ATL Project
41 | [Dd]ebugPS/
42 | [Rr]eleasePS/
43 | dlldata.c
44 |
45 | # DNX
46 | project.lock.json
47 | project.fragment.lock.json
48 | artifacts/
49 |
50 | *_i.c
51 | *_p.c
52 | *_i.h
53 | *.ilk
54 | *.meta
55 | *.obj
56 | *.pch
57 | *.pdb
58 | *.pgc
59 | *.pgd
60 | *.rsp
61 | *.sbr
62 | *.tlb
63 | *.tli
64 | *.tlh
65 | *.tmp
66 | *.tmp_proj
67 | *.log
68 | *.vspscc
69 | *.vssscc
70 | .builds
71 | *.pidb
72 | *.svclog
73 | *.scc
74 |
75 | # Chutzpah Test files
76 | _Chutzpah*
77 |
78 | # Visual C++ cache files
79 | ipch/
80 | *.aps
81 | *.ncb
82 | *.opendb
83 | *.opensdf
84 | *.sdf
85 | *.cachefile
86 | *.VC.db
87 | *.VC.VC.opendb
88 |
89 | # Visual Studio profiler
90 | *.psess
91 | *.vsp
92 | *.vspx
93 | *.sap
94 |
95 | # TFS 2012 Local Workspace
96 | $tf/
97 |
98 | # Guidance Automation Toolkit
99 | *.gpState
100 |
101 | # ReSharper is a .NET coding add-in
102 | _ReSharper*/
103 | *.[Rr]e[Ss]harper
104 | *.DotSettings.user
105 |
106 | # JustCode is a .NET coding add-in
107 | .JustCode
108 |
109 | # TeamCity is a build add-in
110 | _TeamCity*
111 |
112 | # DotCover is a Code Coverage Tool
113 | *.dotCover
114 |
115 | # NCrunch
116 | _NCrunch_*
117 | .*crunch*.local.xml
118 | nCrunchTemp_*
119 |
120 | # MightyMoose
121 | *.mm.*
122 | AutoTest.Net/
123 |
124 | # Web workbench (sass)
125 | .sass-cache/
126 |
127 | # Installshield output folder
128 | [Ee]xpress/
129 |
130 | # DocProject is a documentation generator add-in
131 | DocProject/buildhelp/
132 | DocProject/Help/*.HxT
133 | DocProject/Help/*.HxC
134 | DocProject/Help/*.hhc
135 | DocProject/Help/*.hhk
136 | DocProject/Help/*.hhp
137 | DocProject/Help/Html2
138 | DocProject/Help/html
139 |
140 | # Click-Once directory
141 | publish/
142 |
143 | # Publish Web Output
144 | *.[Pp]ublish.xml
145 | *.azurePubxml
146 | # TODO: Comment the next line if you want to checkin your web deploy settings
147 | # but database connection strings (with potential passwords) will be unencrypted
148 | #*.pubxml
149 | *.publishproj
150 |
151 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
152 | # checkin your Azure Web App publish settings, but sensitive information contained
153 | # in these scripts will be unencrypted
154 | PublishScripts/
155 |
156 | # NuGet Packages
157 | *.nupkg
158 | # The packages folder can be ignored because of Package Restore
159 | **/packages/*
160 | # except build/, which is used as an MSBuild target.
161 | !**/packages/build/
162 | # Uncomment if necessary however generally it will be regenerated when needed
163 | #!**/packages/repositories.config
164 | # NuGet v3's project.json files produces more ignoreable files
165 | *.nuget.props
166 | *.nuget.targets
167 |
168 | # Microsoft Azure Build Output
169 | csx/
170 | *.build.csdef
171 |
172 | # Microsoft Azure Emulator
173 | ecf/
174 | rcf/
175 |
176 | # Windows Store app package directories and files
177 | AppPackages/
178 | BundleArtifacts/
179 | Package.StoreAssociation.xml
180 | _pkginfo.txt
181 |
182 | # Visual Studio cache files
183 | # files ending in .cache can be ignored
184 | *.[Cc]ache
185 | # but keep track of directories ending in .cache
186 | !*.[Cc]ache/
187 |
188 | # Others
189 | ClientBin/
190 | ~$*
191 | *~
192 | *.dbmdl
193 | *.dbproj.schemaview
194 | *.jfm
195 | *.pfx
196 | *.publishsettings
197 | node_modules/
198 | orleans.codegen.cs
199 |
200 | # Since there are multiple workflows, uncomment next line to ignore bower_components
201 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
202 | #bower_components/
203 |
204 | # RIA/Silverlight projects
205 | Generated_Code/
206 |
207 | # Backup & report files from converting an old project file
208 | # to a newer Visual Studio version. Backup files are not needed,
209 | # because we have git ;-)
210 | _UpgradeReport_Files/
211 | Backup*/
212 | UpgradeLog*.XML
213 | UpgradeLog*.htm
214 |
215 | # SQL Server files
216 | *.mdf
217 | *.ldf
218 |
219 | # Business Intelligence projects
220 | *.rdl.data
221 | *.bim.layout
222 | *.bim_*.settings
223 |
224 | # Microsoft Fakes
225 | FakesAssemblies/
226 |
227 | # GhostDoc plugin setting file
228 | *.GhostDoc.xml
229 |
230 | # Node.js Tools for Visual Studio
231 | .ntvs_analysis.dat
232 |
233 | # Visual Studio 6 build log
234 | *.plg
235 |
236 | # Visual Studio 6 workspace options file
237 | *.opt
238 |
239 | # Visual Studio LightSwitch build output
240 | **/*.HTMLClient/GeneratedArtifacts
241 | **/*.DesktopClient/GeneratedArtifacts
242 | **/*.DesktopClient/ModelManifest.xml
243 | **/*.Server/GeneratedArtifacts
244 | **/*.Server/ModelManifest.xml
245 | _Pvt_Extensions
246 |
247 | # Paket dependency manager
248 | .paket/paket.exe
249 | paket-files/
250 |
251 | # FAKE - F# Make
252 | .fake/
253 |
254 | # JetBrains Rider
255 | .idea/
256 | *.sln.iml
257 |
258 | # CodeRush
259 | .cr/
260 |
261 | # Python Tools for Visual Studio (PTVS)
262 | __pycache__/
263 | *.pyc
--------------------------------------------------------------------------------
/Img_Share.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28407.52
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Img_Share", "Img_Share\Img_Share.csproj", "{9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OneDriveShareImage", "OneDriveShareImage\OneDriveShareImage.csproj", "{406191FE-8C99-4060-BE7D-C74EB49CA6D6}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools", "Tools\Tools.csproj", "{3C2B25E8-A60F-4493-9BFE-817B581165DD}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Debug|ARM = Debug|ARM
16 | Debug|ARM64 = Debug|ARM64
17 | Debug|x64 = Debug|x64
18 | Debug|x86 = Debug|x86
19 | Release|Any CPU = Release|Any CPU
20 | Release|ARM = Release|ARM
21 | Release|ARM64 = Release|ARM64
22 | Release|x64 = Release|x64
23 | Release|x86 = Release|x86
24 | EndGlobalSection
25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
26 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|Any CPU.ActiveCfg = Debug|x86
27 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|ARM.ActiveCfg = Debug|ARM
28 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|ARM.Build.0 = Debug|ARM
29 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|ARM.Deploy.0 = Debug|ARM
30 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|ARM64.ActiveCfg = Debug|ARM64
31 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|ARM64.Build.0 = Debug|ARM64
32 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|ARM64.Deploy.0 = Debug|ARM64
33 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|x64.ActiveCfg = Debug|x64
34 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|x64.Build.0 = Debug|x64
35 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|x64.Deploy.0 = Debug|x64
36 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|x86.ActiveCfg = Debug|x86
37 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|x86.Build.0 = Debug|x86
38 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Debug|x86.Deploy.0 = Debug|x86
39 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|Any CPU.ActiveCfg = Release|x86
40 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|ARM.ActiveCfg = Release|ARM
41 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|ARM.Build.0 = Release|ARM
42 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|ARM.Deploy.0 = Release|ARM
43 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|ARM64.ActiveCfg = Release|ARM64
44 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|ARM64.Build.0 = Release|ARM64
45 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|ARM64.Deploy.0 = Release|ARM64
46 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|x64.ActiveCfg = Release|x64
47 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|x64.Build.0 = Release|x64
48 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|x64.Deploy.0 = Release|x64
49 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|x86.ActiveCfg = Release|x86
50 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|x86.Build.0 = Release|x86
51 | {9C0AD67B-EB14-44D9-AC90-5DD4ADD51A59}.Release|x86.Deploy.0 = Release|x86
52 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
54 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Debug|ARM.ActiveCfg = Debug|ARM
55 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Debug|ARM.Build.0 = Debug|ARM
56 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Debug|ARM64.ActiveCfg = Debug|ARM64
57 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Debug|ARM64.Build.0 = Debug|ARM64
58 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Debug|x64.ActiveCfg = Debug|x64
59 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Debug|x64.Build.0 = Debug|x64
60 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Debug|x86.ActiveCfg = Debug|x86
61 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Debug|x86.Build.0 = Debug|x86
62 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
63 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Release|Any CPU.Build.0 = Release|Any CPU
64 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Release|ARM.ActiveCfg = Release|ARM
65 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Release|ARM.Build.0 = Release|ARM
66 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Release|ARM64.ActiveCfg = Release|ARM64
67 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Release|ARM64.Build.0 = Release|ARM64
68 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Release|x64.ActiveCfg = Release|x64
69 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Release|x64.Build.0 = Release|x64
70 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Release|x86.ActiveCfg = Release|x86
71 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}.Release|x86.Build.0 = Release|x86
72 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
73 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
74 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Debug|ARM.ActiveCfg = Debug|ARM
75 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Debug|ARM.Build.0 = Debug|ARM
76 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Debug|ARM64.ActiveCfg = Debug|ARM64
77 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Debug|ARM64.Build.0 = Debug|ARM64
78 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Debug|x64.ActiveCfg = Debug|x64
79 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Debug|x64.Build.0 = Debug|x64
80 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Debug|x86.ActiveCfg = Debug|x86
81 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Debug|x86.Build.0 = Debug|x86
82 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
83 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Release|Any CPU.Build.0 = Release|Any CPU
84 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Release|ARM.ActiveCfg = Release|ARM
85 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Release|ARM.Build.0 = Release|ARM
86 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Release|ARM64.ActiveCfg = Release|ARM64
87 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Release|ARM64.Build.0 = Release|ARM64
88 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Release|x64.ActiveCfg = Release|x64
89 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Release|x64.Build.0 = Release|x64
90 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Release|x86.ActiveCfg = Release|x86
91 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}.Release|x86.Build.0 = Release|x86
92 | EndGlobalSection
93 | GlobalSection(SolutionProperties) = preSolution
94 | HideSolutionNode = FALSE
95 | EndGlobalSection
96 | GlobalSection(ExtensibilityGlobals) = postSolution
97 | SolutionGuid = {87B33820-6A28-4886-A745-BB74B212917B}
98 | EndGlobalSection
99 | EndGlobal
100 |
--------------------------------------------------------------------------------
/Img_Share/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Img_Share/App.xaml.cs:
--------------------------------------------------------------------------------
1 |
2 | using Img_Share.Controls;
3 | using Microsoft.Toolkit.Uwp.Connectivity;
4 | using OneDriveShareImage;
5 | using OneDriveShareImage.Model;
6 | using System;
7 | using Tools;
8 | using Windows.ApplicationModel;
9 | using Windows.ApplicationModel.Activation;
10 | using Windows.Globalization;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Navigation;
14 |
15 | namespace Img_Share
16 | {
17 | ///
18 | /// 提供特定于应用程序的行为,以补充默认的应用程序类。
19 | ///
20 | sealed partial class App : Application
21 | {
22 | ///
23 | /// 初始化单一实例应用程序对象。这是执行的创作代码的第一行,
24 | /// 已执行,逻辑上等同于 main() 或 WinMain()。
25 | ///
26 |
27 | // 建立一个OneDrive工具的全局对象
28 | public static ShareImageTools OneDriveTools = new ShareImageTools();
29 | // 建立一个图片数据库的全局对象
30 | public static ImageDbContext Db = null;
31 | public App()
32 | {
33 | SwitchLanguage();
34 | this.InitializeComponent();
35 | this.Suspending += OnSuspending;
36 | this.UnhandledException += OnUnhandleException;
37 | }
38 |
39 | private void OnUnhandleException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
40 | {
41 | e.Handled = true;
42 | string msg = e.Message;
43 | new PopupMaskTip(msg).Show();
44 | }
45 |
46 | ///
47 | /// 检测系统语言,非中文语言一律切换为英文
48 | ///
49 | private void SwitchLanguage()
50 | {
51 | var Languages = Windows.System.UserProfile.GlobalizationPreferences.Languages;
52 | if (Languages.Count > 0)
53 | {
54 | var language = Languages[0];
55 | if (language.ToLower().IndexOf("zh") != -1)
56 | {
57 | ApplicationLanguages.PrimaryLanguageOverride = "zh-CN";
58 | }
59 | else
60 | {
61 | ApplicationLanguages.PrimaryLanguageOverride = "en-US";
62 | }
63 | }
64 | else
65 | {
66 | ApplicationLanguages.PrimaryLanguageOverride = "en-US";
67 | }
68 | }
69 | protected override void OnActivated(IActivatedEventArgs args)
70 | {
71 | Frame rootFrame = Window.Current.Content as Frame;
72 |
73 | if (args.Kind == ActivationKind.Protocol)
74 | {
75 | var e = args as ProtocolActivatedEventArgs;
76 |
77 | if (rootFrame == null)
78 | {
79 | // 创建要充当导航上下文的框架,并导航到第一页
80 | rootFrame = new Frame();
81 |
82 | rootFrame.NavigationFailed += OnNavigationFailed;
83 |
84 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
85 | {
86 | //TODO: 从之前挂起的应用程序加载状态
87 | }
88 |
89 | // 将框架放在当前窗口中
90 | Window.Current.Content = rootFrame;
91 | if (rootFrame.Content == null)
92 | {
93 | CreateFrame(rootFrame);
94 | }
95 | }
96 | Window.Current.Activate();
97 | }
98 | }
99 | private void CreateFrame(Frame rootFrame)
100 | {
101 | // 当导航堆栈尚未还原时,导航到第一页,
102 | // 并通过将所需信息作为导航参数传入来配置
103 | // 参数
104 | if (!NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable)
105 | {
106 | rootFrame.Navigate(typeof(Pages.NetErrorPage));
107 | }
108 | else
109 | {
110 |
111 | // 如果用户是第一次登录,那么切换到登录页
112 | bool isFirst = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.IsFirstRun, "True"));
113 |
114 | if (isFirst)
115 | {
116 | rootFrame.Navigate(typeof(Pages.LoginPage));
117 | }
118 | else
119 | {
120 | rootFrame.Navigate(typeof(MainPage));
121 | }
122 | }
123 | }
124 | ///
125 | /// 在应用程序由最终用户正常启动时进行调用。
126 | /// 将在启动应用程序以打开特定文件等情况下使用。
127 | ///
128 | /// 有关启动请求和过程的详细信息。
129 | protected override void OnLaunched(LaunchActivatedEventArgs e)
130 | {
131 | Frame rootFrame = Window.Current.Content as Frame;
132 |
133 | // 不要在窗口已包含内容时重复应用程序初始化,
134 | // 只需确保窗口处于活动状态
135 | if (rootFrame == null)
136 | {
137 | // 创建要充当导航上下文的框架,并导航到第一页
138 | rootFrame = new Frame();
139 |
140 | rootFrame.NavigationFailed += OnNavigationFailed;
141 |
142 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
143 | {
144 | //TODO: 从之前挂起的应用程序加载状态
145 | }
146 |
147 | // 将框架放在当前窗口中
148 | Window.Current.Content = rootFrame;
149 | }
150 |
151 | if (e.PrelaunchActivated == false)
152 | {
153 | if (rootFrame.Content == null)
154 | {
155 | // 当导航堆栈尚未还原时,导航到第一页,
156 | // 并通过将所需信息作为导航参数传入来配置
157 | // 参数
158 | if (!NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable)
159 | {
160 | rootFrame.Navigate(typeof(Pages.NetErrorPage));
161 | }
162 | else
163 | {
164 | // 如果用户是第一次登录,那么切换到登录页
165 | bool isFirst = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.IsFirstRun, "True"));
166 |
167 | if (isFirst)
168 | {
169 | rootFrame.Navigate(typeof(Pages.LoginPage));
170 | }
171 | else
172 | {
173 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
174 | }
175 | }
176 |
177 | }
178 | // 确保当前窗口处于活动状态
179 | Window.Current.Activate();
180 | }
181 | }
182 |
183 | ///
184 | /// 导航到特定页失败时调用
185 | ///
186 | ///导航失败的框架
187 | ///有关导航失败的详细信息
188 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
189 | {
190 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
191 | }
192 |
193 | ///
194 | /// 在将要挂起应用程序执行时调用。 在不知道应用程序
195 | /// 无需知道应用程序会被终止还是会恢复,
196 | /// 并让内存内容保持不变。
197 | ///
198 | /// 挂起的请求的源。
199 | /// 有关挂起请求的详细信息。
200 | private void OnSuspending(object sender, SuspendingEventArgs e)
201 | {
202 | var deferral = e.SuspendingOperation.GetDeferral();
203 | //TODO: 保存应用程序状态并停止任何后台活动
204 | deferral.Complete();
205 | }
206 | }
207 | }
208 |
--------------------------------------------------------------------------------
/Img_Share/Assets/BadgeLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/BadgeLogo.scale-100.png
--------------------------------------------------------------------------------
/Img_Share/Assets/BadgeLogo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/BadgeLogo.scale-125.png
--------------------------------------------------------------------------------
/Img_Share/Assets/BadgeLogo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/BadgeLogo.scale-150.png
--------------------------------------------------------------------------------
/Img_Share/Assets/BadgeLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/BadgeLogo.scale-200.png
--------------------------------------------------------------------------------
/Img_Share/Assets/BadgeLogo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/BadgeLogo.scale-400.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Dark.png
--------------------------------------------------------------------------------
/Img_Share/Assets/LargeTile.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/LargeTile.scale-100.png
--------------------------------------------------------------------------------
/Img_Share/Assets/LargeTile.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/LargeTile.scale-125.png
--------------------------------------------------------------------------------
/Img_Share/Assets/LargeTile.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/LargeTile.scale-150.png
--------------------------------------------------------------------------------
/Img_Share/Assets/LargeTile.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/LargeTile.scale-200.png
--------------------------------------------------------------------------------
/Img_Share/Assets/LargeTile.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/LargeTile.scale-400.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Light.png
--------------------------------------------------------------------------------
/Img_Share/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Img_Share/Assets/SmallTile.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/SmallTile.scale-100.png
--------------------------------------------------------------------------------
/Img_Share/Assets/SmallTile.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/SmallTile.scale-125.png
--------------------------------------------------------------------------------
/Img_Share/Assets/SmallTile.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/SmallTile.scale-150.png
--------------------------------------------------------------------------------
/Img_Share/Assets/SmallTile.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/SmallTile.scale-200.png
--------------------------------------------------------------------------------
/Img_Share/Assets/SmallTile.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/SmallTile.scale-400.png
--------------------------------------------------------------------------------
/Img_Share/Assets/SplashScreen.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/SplashScreen.scale-100.png
--------------------------------------------------------------------------------
/Img_Share/Assets/SplashScreen.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/SplashScreen.scale-125.png
--------------------------------------------------------------------------------
/Img_Share/Assets/SplashScreen.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/SplashScreen.scale-150.png
--------------------------------------------------------------------------------
/Img_Share/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Img_Share/Assets/SplashScreen.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/SplashScreen.scale-400.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square150x150Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square150x150Logo.scale-100.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square150x150Logo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square150x150Logo.scale-125.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square150x150Logo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square150x150Logo.scale-150.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square150x150Logo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square150x150Logo.scale-400.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.altform-unplated_targetsize-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.altform-unplated_targetsize-16.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.altform-unplated_targetsize-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.altform-unplated_targetsize-256.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.altform-unplated_targetsize-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.altform-unplated_targetsize-32.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.altform-unplated_targetsize-48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.altform-unplated_targetsize-48.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.scale-100.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.scale-125.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.scale-150.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.scale-400.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.targetsize-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.targetsize-16.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.targetsize-24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.targetsize-24.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.targetsize-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.targetsize-256.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.targetsize-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.targetsize-32.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Square44x44Logo.targetsize-48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Square44x44Logo.targetsize-48.png
--------------------------------------------------------------------------------
/Img_Share/Assets/StoreLogo.backup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/StoreLogo.backup.png
--------------------------------------------------------------------------------
/Img_Share/Assets/StoreLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/StoreLogo.scale-100.png
--------------------------------------------------------------------------------
/Img_Share/Assets/StoreLogo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/StoreLogo.scale-125.png
--------------------------------------------------------------------------------
/Img_Share/Assets/StoreLogo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/StoreLogo.scale-150.png
--------------------------------------------------------------------------------
/Img_Share/Assets/StoreLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/StoreLogo.scale-200.png
--------------------------------------------------------------------------------
/Img_Share/Assets/StoreLogo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/StoreLogo.scale-400.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Wide310x150Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Wide310x150Logo.scale-100.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Wide310x150Logo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Wide310x150Logo.scale-125.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Wide310x150Logo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Wide310x150Logo.scale-150.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Img_Share/Assets/Wide310x150Logo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/Wide310x150Logo.scale-400.png
--------------------------------------------------------------------------------
/Img_Share/Assets/imgHolder_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/imgHolder_dark.png
--------------------------------------------------------------------------------
/Img_Share/Assets/imgHolder_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Assets/imgHolder_light.png
--------------------------------------------------------------------------------
/Img_Share/Controls/GroupMaskControl.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
35 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
54 |
55 |
56 |
57 |
58 |
64 |
65 |
66 |
67 |
68 |
74 |
75 |
76 |
77 |
78 |
79 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/Img_Share/Controls/GroupMaskControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using Img_Share.Dialogs;
2 | using OneDriveShareImage.Model;
3 | using System;
4 | using System.Collections.ObjectModel;
5 | using System.ComponentModel;
6 | using System.Linq;
7 | using System.Runtime.CompilerServices;
8 | using System.Threading.Tasks;
9 | using Tools;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 |
14 | //https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板
15 |
16 | namespace Img_Share.Controls
17 | {
18 | public sealed partial class GroupMaskControl : UserControl,INotifyPropertyChanged
19 | {
20 |
21 | private ObservableCollection GroupCollection = new ObservableCollection();
22 | //创建一个popup对象
23 | private Popup _popup = null;
24 | public GroupMaskControl()
25 | {
26 | this.InitializeComponent();
27 | //将当前的长和框 赋值给控件
28 | this.Width = Window.Current.Bounds.Width;
29 | this.Height = Window.Current.Bounds.Height;
30 | this.HorizontalAlignment = HorizontalAlignment.Center;
31 | this.VerticalAlignment = VerticalAlignment.Center;
32 | var groups = App.Db.Groups;
33 | foreach (var item in groups)
34 | {
35 | GroupCollection.Add(item);
36 | }
37 | //将当前的控价赋值给弹窗的Child属性 Child属性是弹窗需要显示的内容 当前的this是一个Grid控件。
38 | _popup = new Popup();
39 | _popup.Child = this;
40 | //给当前的grid添加一个loaded事件,当使用了ShowAPopup()的时候,也就是弹窗显示了,这个弹窗的内容就是我们的grid,所以我们需要将动画打开了。
41 | this.Loaded += PopupNoticeLoaded;
42 | }
43 |
44 |
45 | ///
46 | /// 显示一个popup弹窗 当需要显示一个弹窗时,执行此方法
47 | ///
48 | public void Show()
49 | {
50 | _popup.IsOpen = true;
51 | MainPage.Current.AddMaskInList(this);
52 | }
53 |
54 |
55 | ///
56 | /// 弹窗加载好了
57 | ///
58 | ///
59 | ///
60 | public void PopupNoticeLoaded(object sender, RoutedEventArgs e)
61 | {
62 |
63 | //打开动画
64 | this.PopupIn.Begin();
65 | }
66 |
67 |
68 | ///
69 | /// 当进入动画完成后 到此
70 | ///
71 | ///
72 | ///
73 | public void Close()
74 | {
75 | //将消失动画打开
76 | this.PopupOut.Begin();
77 | if (MainPage.Current != null)
78 | {
79 | MainPage.Current.RemoveMaskFromList(this);
80 | }
81 | //popout 动画完成后 触发
82 | this.PopupOut.Completed += PopupOutCompleted;
83 | }
84 |
85 |
86 | //弹窗退出动画结束 代表整个过程结束 将弹窗关闭
87 | public void PopupOutCompleted(object sender, object e)
88 | {
89 | _popup.IsOpen = false;
90 | }
91 |
92 | public event PropertyChangedEventHandler PropertyChanged;
93 | public void OnPropertyChanged([CallerMemberName]string propertyName = "")
94 | {
95 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
96 | }
97 |
98 | private void CloseButton_Click(object sender, RoutedEventArgs e)
99 | {
100 | Close();
101 | }
102 |
103 | private async void ChangeNameButton_Click(object sender, RoutedEventArgs e)
104 | {
105 |
106 | var con = AppTools.GetParentObject((FrameworkElement)sender, "GroupItemContainer");
107 | var idCon = AppTools.GetChildObject(con, "ItemId");
108 | var nameCon = AppTools.GetChildObject(con, "GroupItemNameBox");
109 | string id = idCon.Text;
110 | string name = nameCon.Text.Trim();
111 | if (!string.IsNullOrEmpty(id))
112 | {
113 | // 按钮点击后,先确认新名称是否为空
114 | if (string.IsNullOrEmpty(name))
115 | {
116 | new PopupMaskTip(AppTools.GetReswLanguage("GroupNameEmpty")).Show();
117 | return;
118 | }
119 | var item = App.Db.Groups.Where(p => p.GroupId == id).ToList()[0];
120 | // 再确认新名称是否和当前名称相同,相同就没有改名必要了
121 | if (item.GroupName != name)
122 | {
123 | // 再判断新名称是否与其他组名重复,重复的话就弹出提示,不同的话就进行名称修改
124 | bool isIn = App.Db.Groups.Any(p => p.GroupName.ToLower() == name.ToLower());
125 | if (isIn)
126 | {
127 | new PopupMaskTip(AppTools.GetReswLanguage("GroupNameRepeat")).Show();
128 | }
129 | else
130 | {
131 | item.GroupName = name;
132 | var images = App.Db.Images.Where(p => p.GroupId == item.GroupId);
133 | foreach (var img in images)
134 | {
135 | img.GroupName = name;
136 | }
137 | await App.Db.SaveChangesAsync();
138 | AppTools.WriteLocalSetting(AppSettings.IsDatabaseChanged, "True");
139 | new PopupMaskTip(AppTools.GetReswLanguage("GroupRenameSuccess")).Show();
140 | MainPage.Current.GroupCollectionReInit();
141 | }
142 | }
143 | else
144 | {
145 | return;
146 | }
147 | }
148 | }
149 |
150 | private async void RemoveGroupButton_Click(object sender, RoutedEventArgs e)
151 | {
152 | // 移除当前组要注意组内是否还有其他的图片,有的话要注意转移
153 | int GroupCount = GroupCollection.Count;
154 | if (GroupCount <= 1)
155 | {
156 | new PopupMaskTip(AppTools.GetReswLanguage("OnlyOneGroup")).Show();
157 | return;
158 | }
159 | var con = AppTools.GetParentObject((FrameworkElement)sender, "GroupItemContainer");
160 | var idCon = AppTools.GetChildObject(con, "ItemId");
161 | string id = idCon.Text;
162 | if (!string.IsNullOrEmpty(id))
163 | {
164 | var item = App.Db.Groups.Where(p => p.GroupId == id).ToList()[0];
165 | var deleteDialog = new TipDialog(AppTools.GetReswLanguage("DeleteGroupTitle"), AppTools.GetReswLanguage("DeleteGroupTip"), AppTools.GetReswLanguage("MoveImage"), AppTools.GetReswLanguage("Delete"));
166 | var chooseResult = await deleteDialog.ShowAsync();
167 | if (chooseResult == ContentDialogResult.Primary)
168 | {
169 | // 转移图片
170 | int count = App.Db.Images.Where(p => p.GroupId == item.GroupId).Count();
171 | if (count > 0)
172 | {
173 | var groupDialog = new GroupDialog();
174 | var groupResult = await groupDialog.ShowAsync();
175 | if (groupResult == ContentDialogResult.Primary)
176 | {
177 |
178 | var selectGroup = groupDialog.SelectGroup;
179 | if (selectGroup.Equals(item))
180 | {
181 | new PopupMaskTip(AppTools.GetReswLanguage("Sao")).Show();
182 | return;
183 | }
184 | else
185 | {
186 | foreach (var img in App.Db.Images)
187 | {
188 | if (img.GroupId == item.GroupId)
189 | {
190 | img.GroupId = selectGroup.GroupId;
191 | img.GroupName = selectGroup.GroupName;
192 | }
193 | }
194 | App.Db.Groups.Remove(item);
195 | await App.Db.SaveChangesAsync();
196 | GroupCollection.Remove(item);
197 | MainPage.Current.GroupCollectionRemoved(item);
198 | MainPage.Current.HistoryInit();
199 | AppTools.WriteLocalSetting(AppSettings.IsDatabaseChanged, "True");
200 | new PopupMaskTip(AppTools.GetReswLanguage("MoveImageSuccess")).Show();
201 | await Task.Delay(800);
202 | new PopupMaskTip(AppTools.GetReswLanguage("DeleteGroupSuccess")).Show();
203 | }
204 | }
205 | }
206 | else
207 | {
208 | App.Db.Groups.Remove(item);
209 | await App.Db.SaveChangesAsync();
210 | new PopupMaskTip(AppTools.GetReswLanguage("DeleteGroupSuccess")).Show();
211 | }
212 | }
213 | else if (chooseResult == ContentDialogResult.Secondary)
214 | {
215 | // 直接删除分组
216 | var images = App.Db.Images.Where(p => p.GroupId == item.GroupId);
217 | var waittingTip = new HoldMaskTip(AppTools.GetReswLanguage("Deleting"));
218 | waittingTip.Show();
219 | int count = 0;
220 | if (images.Count() > 0)
221 | {
222 | count = await App.OneDriveTools.DeleteImage(images.ToList());
223 | }
224 | if (count > 0)
225 | {
226 | App.Db.Images.RemoveRange(images);
227 | string msg = AppTools.GetReswLanguage("DeleteImageSuccess").Replace("{count}", count.ToString());
228 | new PopupMaskTip(msg).Show();
229 | }
230 | App.Db.Groups.Remove(item);
231 | await App.Db.SaveChangesAsync();
232 | waittingTip.Close();
233 | GroupCollection.Remove(item);
234 | MainPage.Current.GroupCollectionRemoved(item);
235 | MainPage.Current.LastestInit();
236 | MainPage.Current.HistoryInit();
237 | AppTools.WriteLocalSetting(AppSettings.IsDatabaseChanged, "True");
238 | await Task.Delay(800);
239 | new PopupMaskTip(AppTools.GetReswLanguage("DeleteGroupSuccess")).Show();
240 | }
241 | }
242 | }
243 | }
244 | }
245 |
246 |
--------------------------------------------------------------------------------
/Img_Share/Controls/HoldMaskTip.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
35 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
54 |
55 |
56 |
57 |
58 |
64 |
65 |
66 |
67 |
68 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/Img_Share/Controls/HoldMaskTip.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Controls.Primitives;
11 | using Windows.UI.Xaml.Data;
12 | using Windows.UI.Xaml.Input;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Navigation;
15 |
16 | //https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板
17 |
18 | namespace Img_Share.Controls
19 | {
20 | ///
21 | /// 做一个等待提醒
22 | ///
23 | public sealed partial class HoldMaskTip : UserControl
24 | {
25 | //存放弹出框中的信息
26 | private string _popupContent;
27 |
28 | //创建一个popup对象
29 | private Popup _popup = null;
30 | public HoldMaskTip()
31 | {
32 | this.InitializeComponent();
33 | //将当前的长和框 赋值给控件
34 | this.Width = Window.Current.Bounds.Width;
35 | this.Height = Window.Current.Bounds.Height;
36 | this.HorizontalAlignment = HorizontalAlignment.Center;
37 | this.VerticalAlignment = VerticalAlignment.Center;
38 |
39 | //将当前的控价赋值给弹窗的Child属性 Child属性是弹窗需要显示的内容 当前的this是一个Grid控件。
40 | _popup = new Popup();
41 | _popup.Child = this;
42 |
43 | //给当前的grid添加一个loaded事件,当使用了ShowAPopup()的时候,也就是弹窗显示了,这个弹窗的内容就是我们的grid,所以我们需要将动画打开了。
44 | this.Loaded += PopupNoticeLoaded;
45 | }
46 | ///
47 | /// 重载
48 | ///
49 | /// 弹出框中的内容
50 | public HoldMaskTip(string popupContentString) : this()
51 | {
52 | _popupContent = popupContentString;
53 | }
54 |
55 |
56 | ///
57 | /// 显示一个popup弹窗 当需要显示一个弹窗时,执行此方法
58 | ///
59 | public void Show()
60 | {
61 | _popup.IsOpen = true;
62 | if (MainPage.Current != null)
63 | {
64 | MainPage.Current.AddMaskInList(this);
65 | }
66 | }
67 |
68 |
69 | ///
70 | /// 弹窗加载好了
71 | ///
72 | ///
73 | ///
74 | public void PopupNoticeLoaded(object sender, RoutedEventArgs e)
75 | {
76 | PopupContent.Text = _popupContent;
77 |
78 | //打开动画
79 | this.PopupIn.Begin();
80 | }
81 |
82 |
83 | ///
84 | /// 当进入动画完成后 到此
85 | ///
86 | ///
87 | ///
88 | public void Close()
89 | {
90 | //将消失动画打开
91 | this.PopupOut.Begin();
92 | if (MainPage.Current != null)
93 | {
94 | MainPage.Current.RemoveMaskFromList(this);
95 | }
96 | //popout 动画完成后 触发
97 | this.PopupOut.Completed += PopupOutCompleted;
98 | }
99 |
100 |
101 | //弹窗退出动画结束 代表整个过程结束 将弹窗关闭
102 | public void PopupOutCompleted(object sender, object e)
103 | {
104 | _popup.IsOpen = false;
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/Img_Share/Controls/ImageMaskControl.xaml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
23 |
24 |
25 |
26 |
27 |
33 |
34 |
35 |
36 |
37 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
56 |
57 |
58 |
59 |
60 |
66 |
67 |
68 |
69 |
70 |
76 |
77 |
78 |
79 |
80 |
81 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
110 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
--------------------------------------------------------------------------------
/Img_Share/Controls/ImageMaskControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using Img_Share.Dialogs;
2 | using OneDriveShareImage.Model;
3 | using System;
4 | using System.ComponentModel;
5 | using System.Linq;
6 | using System.Runtime.CompilerServices;
7 | using Tools;
8 | using Windows.ApplicationModel.DataTransfer;
9 | using Windows.Foundation.Metadata;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Media.Imaging;
14 |
15 | //https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板
16 |
17 | namespace Img_Share.Controls
18 | {
19 | ///
20 | /// 图片详情控件
21 | ///
22 | public sealed partial class ImageMaskControl : UserControl,INotifyPropertyChanged
23 | {
24 | public OneDriveImage imageFile;
25 | private string _fileName;
26 | private string _groupName;
27 | private string _link;
28 | public string GroupId;
29 | private string _rp;
30 |
31 | ///
32 | /// 文件名
33 | ///
34 | public string FileName
35 | {
36 | get => _fileName;
37 | set { _fileName = value; OnPropertyChanged(); }
38 | }
39 |
40 | ///
41 | /// 组名
42 | ///
43 | public string GroupName
44 | {
45 | get => _groupName;
46 | set { _groupName = value; OnPropertyChanged(); }
47 | }
48 |
49 | ///
50 | /// 图片链接
51 | ///
52 | public string Link
53 | {
54 | get => _link;
55 | set { _link = value; OnPropertyChanged(); }
56 | }
57 |
58 | ///
59 | /// 分辨率
60 | ///
61 | public string RP
62 | {
63 | get => _rp;
64 | set { _rp = value;OnPropertyChanged(); }
65 | }
66 |
67 | private BitmapImage _holderImage;
68 | ///
69 | /// 占位图片
70 | ///
71 | public BitmapImage HolderImage
72 | {
73 | get => _holderImage;
74 | set { _holderImage = value; OnPropertyChanged(); }
75 | }
76 |
77 | //创建一个popup对象
78 | private Popup _popup = null;
79 | public ImageMaskControl()
80 | {
81 | this.InitializeComponent();
82 | //将当前的长和框 赋值给控件
83 | this.Width = Window.Current.Bounds.Width;
84 | this.Height = Window.Current.Bounds.Height;
85 | this.HorizontalAlignment = HorizontalAlignment.Center;
86 | this.VerticalAlignment = VerticalAlignment.Center;
87 |
88 | //将当前的控价赋值给弹窗的Child属性 Child属性是弹窗需要显示的内容 当前的this是一个Grid控件。
89 | _popup = new Popup();
90 | _popup.Child = this;
91 | bool isDark = App.Current.RequestedTheme == ApplicationTheme.Dark;
92 | // 由于ImageEx的 CornerRadius 属性在1809以上才可用,故此需要进行一个判断
93 | bool is1809 = ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7);
94 | if (is1809)
95 | {
96 | MyImageEx.CornerRadius = new CornerRadius(5);
97 | }
98 | if (isDark)
99 | {
100 | HolderImage = new BitmapImage(new Uri("ms-appx:///Assets/imgHolder_dark.png"));
101 | }
102 | else
103 | {
104 | HolderImage = new BitmapImage(new Uri("ms-appx:///Assets/imgHolder_light.png"));
105 | }
106 | ToolTipService.SetToolTip(CopytoMdButton, AppTools.GetReswLanguage("CopyToMarkdown"));
107 | ToolTipService.SetToolTip(CopytoHtmlButton, AppTools.GetReswLanguage("CopyToHTML"));
108 | //给当前的grid添加一个loaded事件,当使用了ShowAPopup()的时候,也就是弹窗显示了,这个弹窗的内容就是我们的grid,所以我们需要将动画打开了。
109 | this.Loaded += PopupNoticeLoaded;
110 | }
111 | ///
112 | /// 重载
113 | ///
114 | /// 弹出框中的内容
115 | public ImageMaskControl(OneDriveImage image) : this()
116 | {
117 | Init(image);
118 | }
119 |
120 | ///
121 | /// 对传入的图片对象进行解析
122 | ///
123 | ///
124 | public void Init(OneDriveImage image)
125 | {
126 | imageFile = image;
127 | FileName = image.ImageName;
128 | GroupId = image.GroupId;
129 | Link = image.URL;
130 | GroupName = image.GroupName;
131 | RP = image.Width + " * " + image.Height;
132 | }
133 |
134 |
135 | ///
136 | /// 显示一个popup弹窗 当需要显示一个弹窗时,执行此方法
137 | ///
138 | public void Show()
139 | {
140 | _popup.IsOpen = true;
141 | MainPage.Current.AddMaskInList(this);
142 | }
143 |
144 |
145 | ///
146 | /// 弹窗加载好了
147 | ///
148 | ///
149 | ///
150 | public void PopupNoticeLoaded(object sender, RoutedEventArgs e)
151 | {
152 |
153 | //打开动画
154 | if (MainPage.Current != null)
155 | {
156 | this.PopupIn.Begin();
157 | }
158 | }
159 |
160 |
161 | ///
162 | /// 当进入动画完成后 到此
163 | ///
164 | ///
165 | ///
166 | public void Close()
167 | {
168 | //将消失动画打开
169 | this.PopupOut.Begin();
170 | if (MainPage.Current != null)
171 | {
172 | MainPage.Current.RemoveMaskFromList(this);
173 | }
174 | //popout 动画完成后 触发
175 | this.PopupOut.Completed += PopupOutCompleted;
176 | }
177 |
178 |
179 | //弹窗退出动画结束 代表整个过程结束 将弹窗关闭
180 | public void PopupOutCompleted(object sender, object e)
181 | {
182 | _popup.IsOpen = false;
183 | }
184 |
185 | public event PropertyChangedEventHandler PropertyChanged;
186 | public void OnPropertyChanged([CallerMemberName]string propertyName = "")
187 | {
188 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
189 | }
190 |
191 | private void CloseButton_Click(object sender, RoutedEventArgs e)
192 | {
193 | Close();
194 | }
195 |
196 | private void CopyButton_Click(object sender, RoutedEventArgs e)
197 | {
198 | CopyImage("url");
199 | }
200 |
201 | private void CopytoMdButton_Click(object sender, RoutedEventArgs e)
202 | {
203 | CopyImage("md");
204 | }
205 |
206 | private void CopytoHtmlButton_Click(object sender, RoutedEventArgs e)
207 | {
208 | CopyImage("img");
209 | }
210 | ///
211 | /// 复制不同类型的链接
212 | ///
213 | /// 类型
214 | private void CopyImage(string type)
215 | {
216 | string str = string.Empty;
217 | string tipKey = string.Empty;
218 | switch (type.ToLower())
219 | {
220 | case "url":
221 | str= Link;
222 | tipKey = "CopiedLink";
223 | break;
224 | case "md":
225 | str = $"";
226 | tipKey = "CopiedMd";
227 | break;
228 | case "html":
229 | str = $"
";
230 | tipKey = "CopiedImg";
231 | break;
232 | }
233 | var dp = new DataPackage();
234 | dp.SetText(str);
235 | Clipboard.SetContent(dp);
236 | new PopupMaskTip(AppTools.GetReswLanguage(tipKey)).Show();
237 | }
238 |
239 | private async void DeleteButton_Click(object sender, RoutedEventArgs e)
240 | {
241 | // 删除图片时,执行两个步骤
242 | // 1. 先删除OneDrive中的源文件
243 | // 2. 成功后删除数据库中记录的数据,并将数据库的状态设置为Change
244 | var tipDialog = new TipDialog(AppTools.GetReswLanguage("DeleteImageTipTitle"), AppTools.GetReswLanguage("DeleteImageTipContent"), true);
245 | var result=await tipDialog.ShowAsync();
246 | if (result == ContentDialogResult.Primary)
247 | {
248 | var images = App.Db.Images.Where(p => p.ImageId == imageFile.ImageId);
249 | var waittingTip = new HoldMaskTip(AppTools.GetReswLanguage("Deleting"));
250 | waittingTip.Show();
251 | int count = 0;
252 | if (images.Count() > 0)
253 | {
254 | count = await App.OneDriveTools.DeleteImage(images.ToList());
255 | }
256 | if (count > 0)
257 | {
258 | App.Db.Images.RemoveRange(images);
259 | string msg = AppTools.GetReswLanguage("DeleteImageSuccess").Replace("{count}", count.ToString());
260 | new PopupMaskTip(msg).Show();
261 | }
262 | await App.Db.SaveChangesAsync();
263 | Close();
264 | waittingTip.Close();
265 | MainPage.Current.LastestInit();
266 | MainPage.Current.HistoryInit();
267 | AppTools.WriteLocalSetting(AppSettings.IsDatabaseChanged, "True");
268 | }
269 | }
270 |
271 | ///
272 | /// 转移图片只需要修改数据库中的分组信息即可
273 | ///
274 | ///
275 | ///
276 | private async void MoveButton_Click(object sender, RoutedEventArgs e)
277 | {
278 | var groupDialog = new GroupDialog();
279 | var groupResult = await groupDialog.ShowAsync();
280 | if (groupResult == ContentDialogResult.Primary)
281 | {
282 |
283 | var selectGroup = groupDialog.SelectGroup;
284 | if (selectGroup.GroupId==GroupId)
285 | {
286 | new PopupMaskTip(AppTools.GetReswLanguage("Sao")).Show();
287 | return;
288 | }
289 | else
290 | {
291 | foreach (var img in App.Db.Images)
292 | {
293 | if (img.ImageId == imageFile.ImageId)
294 | {
295 | img.GroupId = selectGroup.GroupId;
296 | img.GroupName = selectGroup.GroupName;
297 | }
298 | }
299 | await App.Db.SaveChangesAsync();
300 | MainPage.Current.HistoryInit();
301 | AppTools.WriteLocalSetting(AppSettings.IsDatabaseChanged, "True");
302 | GroupName = selectGroup.GroupName;
303 | new PopupMaskTip(AppTools.GetReswLanguage("MoveImageSuccess")).Show();
304 | }
305 | }
306 | }
307 |
308 | ///
309 | /// 修改图片名称
310 | ///
311 | ///
312 | ///
313 | private async void ChangeFileNameButton_Click(object sender, RoutedEventArgs e)
314 | {
315 | if (FileName == imageFile.ImageName)
316 | {
317 | return;
318 | }
319 | // 图片名称必须包含扩展名
320 | string[] tempSp = FileName.Split(".");
321 | // 图片名称中不能有Windows不能识别的非法字符
322 | char[] notAllowChar = new char[] { '<', '>', '/', '\\', ':', '"', '*', '?' };
323 | string[] goodExtends = new string[] { "jpg", "jpeg", "png", "bmp", "gif", "webp" };
324 | if (tempSp.Length<2 || !goodExtends.Any(p => p == tempSp[tempSp.Length - 1].ToLower()))
325 | {
326 | new PopupMaskTip(AppTools.GetReswLanguage("FileNameErrorExtends")).Show();
327 | return;
328 | }
329 | else
330 | {
331 | bool isNotAllow = FileName.Any(p => notAllowChar.Any(s => s == p));
332 | if (isNotAllow)
333 | {
334 | new PopupMaskTip(AppTools.GetReswLanguage("PrefixNotAllow")).Show();
335 | }
336 | else
337 | {
338 | // 完成之后,修改OneDrive中保存的图片名以及数据库内的记录,并将数据库状态设置为Change
339 | var tip = new HoldMaskTip(AppTools.GetReswLanguage("WaitToChange"));
340 | tip.Show();
341 | string name = await App.OneDriveTools.RenameImage(imageFile, FileName);
342 | foreach (var item in App.Db.Images)
343 | {
344 | if (item.ImageName == imageFile.ImageName)
345 | {
346 | item.ImageName = name;
347 | break;
348 | }
349 | }
350 | await App.Db.SaveChangesAsync();
351 | AppTools.WriteLocalSetting(AppSettings.IsDatabaseChanged, "True");
352 | FileName = name;
353 | imageFile.ImageName = name;
354 | tip.Close();
355 | new PopupMaskTip(AppTools.GetReswLanguage("FileNameChangeSuccess")).Show();
356 | }
357 | }
358 | }
359 | }
360 | }
361 |
--------------------------------------------------------------------------------
/Img_Share/Controls/MyImage.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/Img_Share/Controls/MyImage.xaml.cs:
--------------------------------------------------------------------------------
1 | using OneDriveShareImage.Model;
2 | using System;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Runtime.CompilerServices;
6 | using Tools;
7 | using Windows.ApplicationModel.DataTransfer;
8 | using Windows.Foundation.Metadata;
9 | using Windows.System;
10 | using Windows.UI.Core;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Input;
14 | using Windows.UI.Xaml.Media.Imaging;
15 |
16 | //https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板
17 |
18 | namespace Img_Share.Controls
19 | {
20 | ///
21 | /// 这是主要的图片显示控件,对ImageEx进行了二次封装
22 | ///
23 | public sealed partial class MyImage : UserControl,INotifyPropertyChanged
24 | {
25 | private string _imageLink;
26 | ///
27 | /// 图片链接
28 | ///
29 | public string ImageLink
30 | {
31 | get => _imageLink;
32 | set { _imageLink = value; OnPropertyChanged(); }
33 | }
34 | private BitmapImage _holderImage;
35 | ///
36 | /// 占位图片
37 | ///
38 | public BitmapImage HolderImage
39 | {
40 | get => _holderImage;
41 | set { _holderImage = value; OnPropertyChanged(); }
42 | }
43 | public MyImage()
44 | {
45 | this.InitializeComponent();
46 | // ImageEx的CornerRadius属性仅在1809及以上可用
47 | bool is1809 = ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7);
48 | if (is1809)
49 | {
50 | ImageBlock.CornerRadius = new CornerRadius(10);
51 | }
52 | bool isDark = App.Current.RequestedTheme == ApplicationTheme.Dark;
53 | if (isDark)
54 | {
55 | HolderImage = new BitmapImage(new Uri("ms-appx:///Assets/imgHolder_dark.png"));
56 | }
57 | else
58 | {
59 | HolderImage = new BitmapImage(new Uri("ms-appx:///Assets/imgHolder_light.png"));
60 | }
61 | }
62 |
63 | public event PropertyChangedEventHandler PropertyChanged;
64 | public void OnPropertyChanged([CallerMemberName]string propertyName = "")
65 | {
66 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
67 | }
68 |
69 | ///
70 | /// 图片点击事件
71 | ///
72 | ///
73 | ///
74 | private void ImageBlock_Tapped(object sender, TappedRoutedEventArgs e)
75 | {
76 | ImageBlockMouseDown.Begin();
77 | var imgTemp = App.Db.Images.Where(p => p.URL == ImageLink).ToList();
78 | var img = new OneDriveImage();
79 | if (imgTemp.Count > 0)
80 | {
81 | img = imgTemp[0];
82 | }
83 | else
84 | {
85 | // 这里是为了检测图片链接的准确性进行的异常捕获
86 | img = null;
87 | new PopupMaskTip(AppTools.GetReswLanguage("NotExist")).Show();
88 | }
89 | if (img != null)
90 | {
91 | // 这里加入了快捷复制的功能,即按住某个键点击图片即可在不显示图片详情时直接复制链接
92 | var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control);
93 | var shift = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift);
94 | var alt = Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu);
95 | if (ctrl.HasFlag(CoreVirtualKeyStates.Down) && !shift.HasFlag(CoreVirtualKeyStates.Down) && !alt.HasFlag(CoreVirtualKeyStates.Down))
96 | {
97 | // ctrl
98 | // 直接复制连接
99 | CopyImage(img, "url");
100 | }
101 | else if (!ctrl.HasFlag(CoreVirtualKeyStates.Down) && shift.HasFlag(CoreVirtualKeyStates.Down) && !alt.HasFlag(CoreVirtualKeyStates.Down))
102 | {
103 | // shift
104 | // 直接复制Markdown连接
105 | CopyImage(img, "md");
106 | }
107 | else if (!ctrl.HasFlag(CoreVirtualKeyStates.Down) && !shift.HasFlag(CoreVirtualKeyStates.Down) && alt.HasFlag(CoreVirtualKeyStates.Down))
108 | {
109 | // alt
110 | // 复制img标签
111 | CopyImage(img, "img");
112 | }
113 | else
114 | {
115 | var mask = new ImageMaskControl(imgTemp[0]);
116 | mask.Show();
117 | }
118 | }
119 |
120 |
121 | }
122 |
123 | ///
124 | /// 复制不同类型的链接
125 | ///
126 | /// 类型
127 | private void CopyImage(OneDriveImage img, string type)
128 | {
129 | string str = string.Empty;
130 | string tipKey = string.Empty;
131 | switch (type.ToLower())
132 | {
133 | case "url":
134 | str = img.URL;
135 | tipKey = "CopiedLink";
136 | break;
137 | case "md":
138 | str = $"";
139 | tipKey = "CopiedMd";
140 | break;
141 | case "html":
142 | str = $"
";
143 | tipKey = "CopiedImg";
144 | break;
145 | }
146 | var dp = new DataPackage();
147 | dp.SetText(str);
148 | Clipboard.SetContent(dp);
149 | new PopupMaskTip(AppTools.GetReswLanguage(tipKey)).Show();
150 | }
151 |
152 | private void ImageBlockMouseDown_Completed(object sender, object e)
153 | {
154 | ImageBlockMouseUp.Begin();
155 | }
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/Img_Share/Controls/PopupMaskTip.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
44 |
45 |
46 |
47 |
48 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/Img_Share/Controls/PopupMaskTip.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Windows.UI.Xaml;
3 | using Windows.UI.Xaml.Controls;
4 | using Windows.UI.Xaml.Controls.Primitives;
5 |
6 | //https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板
7 |
8 | namespace Img_Share.Controls
9 | {
10 | public sealed partial class PopupMaskTip : UserControl
11 | {
12 | private string _popupContent;
13 |
14 | //创建一个popup对象
15 | private Popup _popup = null;
16 | public PopupMaskTip()
17 | {
18 | this.InitializeComponent();
19 | //将当前的长和框 赋值给控件
20 | this.Width = Window.Current.Bounds.Width;
21 | this.Height = Window.Current.Bounds.Height;
22 |
23 | //将当前的控价赋值给弹窗的Child属性 Child属性是弹窗需要显示的内容 当前的this是一个Grid控件。
24 | _popup = new Popup();
25 | _popup.Child = this;
26 |
27 | //给当前的grid添加一个loaded事件,当使用了ShowAPopup()的时候,也就是弹窗显示了,这个弹窗的内容就是我们的grid,所以我们需要将动画打开了。
28 | this.Loaded += PopupNoticeLoaded;
29 | }
30 | ///
31 | /// 重载
32 | ///
33 | /// 弹出框中的内容
34 | public PopupMaskTip(string popupContentString) : this()
35 | {
36 | _popupContent = popupContentString;
37 | }
38 |
39 |
40 | ///
41 | /// 显示一个popup弹窗 当需要显示一个弹窗时,执行此方法
42 | ///
43 | public void Show()
44 | {
45 | _popup.IsOpen = true;
46 | if (MainPage.Current != null)
47 | {
48 | MainPage.Current.AddMaskInList(this);
49 | }
50 |
51 | }
52 |
53 |
54 | ///
55 | /// 弹窗加载好了
56 | ///
57 | ///
58 | ///
59 | public void PopupNoticeLoaded(object sender, RoutedEventArgs e)
60 | {
61 | PopupContent.Text = _popupContent;
62 |
63 | //打开动画
64 | this.PopupIn.Begin();
65 |
66 | //当进入动画执行之后,代表着弹窗已经到指定位置了,再指定位置等一秒 就可以消失回去了
67 | this.PopupIn.Completed += PopupInCompleted;
68 | }
69 |
70 |
71 | ///
72 | /// 当进入动画完成后 到此
73 | ///
74 | ///
75 | ///
76 | public async void PopupInCompleted(object sender, object e)
77 | {
78 | //在原地续一秒
79 | await Task.Delay(2000);
80 |
81 | //将消失动画打开
82 | this.PopupOut.Begin();
83 | //popout 动画完成后 触发
84 | this.PopupOut.Completed += PopupOutCompleted;
85 | }
86 |
87 |
88 | //弹窗退出动画结束 代表整个过程结束 将弹窗关闭
89 | public void PopupOutCompleted(object sender, object e)
90 | {
91 | _popup.IsOpen = false;
92 | if (MainPage.Current != null)
93 | {
94 | MainPage.Current.RemoveMaskFromList(this);
95 | }
96 |
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/Img_Share/Controls/SettingControl.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
30 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
67 |
73 |
74 |
75 |
76 |
77 |
78 |
83 |
84 |
85 |
86 |
87 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
--------------------------------------------------------------------------------
/Img_Share/Controls/SettingControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using Img_Share.Dialogs;
2 | using OneDriveShareImage.Model;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.ComponentModel;
7 | using System.IO;
8 | using System.Linq;
9 | using System.Runtime.CompilerServices;
10 | using System.Runtime.InteropServices.WindowsRuntime;
11 | using Tools;
12 | using Windows.Foundation;
13 | using Windows.Foundation.Collections;
14 | using Windows.System;
15 | using Windows.UI.Xaml;
16 | using Windows.UI.Xaml.Controls;
17 | using Windows.UI.Xaml.Controls.Primitives;
18 | using Windows.UI.Xaml.Data;
19 | using Windows.UI.Xaml.Input;
20 | using Windows.UI.Xaml.Media;
21 | using Windows.UI.Xaml.Navigation;
22 |
23 | //https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板
24 |
25 | namespace Img_Share.Controls
26 | {
27 | public sealed partial class SettingControl : UserControl,INotifyPropertyChanged
28 | {
29 | private string _authKey;
30 |
31 | public string AuthKey
32 | {
33 | get => _authKey;
34 | set
35 | {
36 | _authKey = value;
37 | OnPropertyChanged();
38 | }
39 | }
40 |
41 | public ObservableCollection GroupCollection = new ObservableCollection();
42 | private bool isInit = false;
43 | private Popup _popup = null;
44 | public SettingControl()
45 | {
46 | this.InitializeComponent();
47 | //将当前的长和框 赋值给控件
48 | this.Width = Window.Current.Bounds.Width;
49 | this.Height = Window.Current.Bounds.Height;
50 | this.HorizontalAlignment = HorizontalAlignment.Center;
51 | this.VerticalAlignment = VerticalAlignment.Center;
52 | //将当前的控价赋值给弹窗的Child属性 Child属性是弹窗需要显示的内容 当前的this是一个Grid控件。
53 | _popup = new Popup();
54 | _popup.Child = this;
55 | //给当前的grid添加一个loaded事件,当使用了ShowAPopup()的时候,也就是弹窗显示了,这个弹窗的内容就是我们的grid,所以我们需要将动画打开了。
56 | this.Loaded += PopupNoticeLoaded;
57 | AuthKey = AppTools.GetLocalSetting(AppSettings.AuthKey, "");
58 | var group = App.Db.Groups;
59 | foreach (var item in group)
60 | {
61 | GroupCollection.Add(item);
62 | }
63 | GroupNameCombo.SelectedItem = GroupCollection.First();
64 | ToolTipService.SetToolTip(OpenSourceButton, AppTools.GetReswLanguage("OpenSourceButton"));
65 | ToolTipService.SetToolTip(UseInfoButton, AppTools.GetReswLanguage("UseInfoButton"));
66 | bool isAutoRename = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.AutoRename, "True"));
67 | AutoRenameSwitch.IsOn = isAutoRename;
68 | isInit = true;
69 | }
70 |
71 |
72 | ///
73 | /// 显示一个popup弹窗 当需要显示一个弹窗时,执行此方法
74 | ///
75 | public void Show()
76 | {
77 | _popup.IsOpen = true;
78 | if (MainPage.Current != null)
79 | {
80 | MainPage.Current.AddMaskInList(this);
81 | }
82 | }
83 |
84 |
85 | ///
86 | /// 弹窗加载好了
87 | ///
88 | ///
89 | ///
90 | public void PopupNoticeLoaded(object sender, RoutedEventArgs e)
91 | {
92 |
93 | //打开动画
94 | this.PopupIn.Begin();
95 | }
96 |
97 |
98 | ///
99 | /// 当进入动画完成后 到此
100 | ///
101 | ///
102 | ///
103 | public void Close()
104 | {
105 | //将消失动画打开
106 | this.PopupOut.Begin();
107 | if (MainPage.Current != null)
108 | {
109 | MainPage.Current.RemoveMaskFromList(this);
110 | }
111 | //popout 动画完成后 触发
112 | this.PopupOut.Completed += PopupOutCompleted;
113 | }
114 |
115 |
116 | //弹窗退出动画结束 代表整个过程结束 将弹窗关闭
117 | public void PopupOutCompleted(object sender, object e)
118 | {
119 | _popup.IsOpen = false;
120 | }
121 |
122 | public event PropertyChangedEventHandler PropertyChanged;
123 | public void OnPropertyChanged([CallerMemberName]string propertyName = "")
124 | {
125 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
126 | }
127 |
128 | private void CloseButton_Click(object sender, RoutedEventArgs e)
129 | {
130 | Close();
131 | }
132 |
133 | private void AuthKeyTextBox_KeyDown(object sender, KeyRoutedEventArgs e)
134 | {
135 | if (e.Key == VirtualKey.Enter)
136 | {
137 | ModifyAuthKey();
138 | }
139 | }
140 |
141 | private void EnSureAuthKeyButton_Click(object sender, RoutedEventArgs e)
142 | {
143 | ModifyAuthKey();
144 | }
145 |
146 | ///
147 | /// 更改授权码
148 | ///
149 | private async void ModifyAuthKey()
150 | {
151 | string oldKey = AppTools.GetLocalSetting(AppSettings.AuthKey, "");
152 | string newKey = AuthKey.Trim();
153 | if (string.IsNullOrEmpty(newKey))
154 | {
155 | new PopupMaskTip(AppTools.GetReswLanguage("AuthKeyEmpty")).Show();
156 | return;
157 | }
158 | if (oldKey == newKey)
159 | {
160 | return;
161 | }
162 | else
163 | {
164 | if (App.Db.Images.Count() > 0)
165 | {
166 | // 弹出警告,询问是否对数据库内所有条目进行修改
167 | var warning = new TipDialog(AppTools.GetReswLanguage("AuthorizeChangeTitle"), AppTools.GetReswLanguage("AuthorizeChangeTip"),AppTools.GetReswLanguage("Yes"),AppTools.GetReswLanguage("No"));
168 | var result = await warning.ShowAsync();
169 | if (result == ContentDialogResult.Primary)
170 | {
171 | foreach (var item in App.Db.Images)
172 | {
173 | // 这里是修改链接内的AuthKey
174 | int index = item.URL.LastIndexOf("key=")+4;
175 | item.URL = item.URL.Replace(item.URL.Substring(index), newKey);
176 | }
177 | await App.Db.SaveChangesAsync();
178 | AppTools.WriteLocalSetting(AppSettings.AuthKey, newKey);
179 | MainPage.Current.HistoryInit();
180 | MainPage.Current.LastestInit();
181 | new PopupMaskTip(AppTools.GetReswLanguage("AuthorizeChangeSuccess")).Show();
182 | }
183 | else if (result == ContentDialogResult.Secondary)
184 | {
185 | AppTools.WriteLocalSetting(AppSettings.AuthKey, newKey);
186 | new PopupMaskTip(AppTools.GetReswLanguage("AuthorizeChangeSuccess")).Show();
187 | }
188 | }
189 | else
190 | {
191 | AppTools.WriteLocalSetting(AppSettings.AuthKey, newKey);
192 | new PopupMaskTip(AppTools.GetReswLanguage("AuthorizeChangeSuccess")).Show();
193 | }
194 | }
195 | }
196 |
197 | private void GroupNameCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
198 | {
199 | if (!isInit)
200 | return;
201 | // 自动为组填充前缀
202 | var item = (OneDriveImageGroup)GroupNameCombo.SelectedItem;
203 | string name = item.GroupName;
204 | PrefixTextBox.Text = name + "-";
205 | }
206 |
207 | ///
208 | /// 为组内所有图片批量添加前缀
209 | ///
210 | ///
211 | ///
212 | private async void AddPrefixButton_Click(object sender, RoutedEventArgs e)
213 | {
214 | // 这个方法会将组内的所有图片全部加上统一的前缀,即便这个图片有前缀了,照加不误,因为没有做判断
215 | string prefix = PrefixTextBox.Text;
216 | char[] notAllowChar = new char[] { '<', '>', '/', '\\', ':', '"', '*', '?' };
217 | if (string.IsNullOrEmpty(prefix) || string.IsNullOrWhiteSpace(prefix))
218 | {
219 | new PopupMaskTip(AppTools.GetReswLanguage("PrefixEmpty")).Show();
220 | }
221 | else
222 | {
223 | bool isNotAllow = prefix.Any(p => notAllowChar.Any(s => s == p));
224 | if (isNotAllow)
225 | {
226 | new PopupMaskTip(AppTools.GetReswLanguage("PrefixNotAllow")).Show();
227 | }
228 | else
229 | {
230 | var item = (OneDriveImageGroup)GroupNameCombo.SelectedItem;
231 | var images = App.Db.Images.Where(p => p.GroupId == item.GroupId).ToList();
232 | // 按顺序为每张图片执行改名过程
233 | // 先将OneDrive内的图片源文件进行改名
234 | // 然后再修改数据库内的内容,并将数据库的状态设置为Change
235 |
236 | // Tip. 图片名称的修改不会影响到链接,因为链接中包含的是图片在OneDrive内的资源ID,这个是唯一的,且不可修改
237 | if (images.Count > 0)
238 | {
239 | string tipMsg = AppTools.GetReswLanguage("AddPrefixTipContent").Replace("{group}", item.GroupName).Replace("{count}", images.Count.ToString()).Replace("{prefix}", prefix);
240 | var tipDialog = new TipDialog(AppTools.GetReswLanguage("AddPrefixTipTitle"), tipMsg, true);
241 | var result = await tipDialog.ShowAsync();
242 | if (result == ContentDialogResult.Primary)
243 | {
244 | var tip = new HoldMaskTip(AppTools.GetReswLanguage("WaitToChange"));
245 | tip.Show();
246 | int count = await App.OneDriveTools.RenameImage(images, prefix);
247 | if (count > 0)
248 | {
249 | foreach (var img in App.Db.Images)
250 | {
251 | img.ImageName = prefix + img.ImageName;
252 | }
253 | await App.Db.SaveChangesAsync();
254 | AppTools.WriteLocalSetting(AppSettings.IsDatabaseChanged, "True");
255 | new PopupMaskTip(AppTools.GetReswLanguage("FileNameChangeSuccess")).Show();
256 | }
257 | tip.Close();
258 | }
259 | }
260 | else
261 | {
262 | string msg = AppTools.GetReswLanguage("NoImageTip");
263 | new PopupMaskTip(msg).Show();
264 | }
265 | }
266 | }
267 |
268 | }
269 |
270 | private async void OpenSourceButton_Click(object sender, RoutedEventArgs e)
271 | {
272 | // 开源地址
273 | await Launcher.LaunchUriAsync(new Uri("https://github.com/Richasy/Img-Share"));
274 | }
275 |
276 | private async void UseInfoButton_Click(object sender, RoutedEventArgs e)
277 | {
278 | // 应用说明书
279 | await Launcher.LaunchUriAsync(new Uri("https://www.richasy.cn/apps/pictureshare.html"));
280 | }
281 |
282 | private void AutoRenameSwitch_Toggled(object sender, RoutedEventArgs e)
283 | {
284 | if (!isInit)
285 | return;
286 | AppTools.WriteLocalSetting(AppSettings.AutoRename, AutoRenameSwitch.IsOn.ToString());
287 | }
288 | }
289 | }
290 |
--------------------------------------------------------------------------------
/Img_Share/Dialogs/AddGroupDialog.xaml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Img_Share/Dialogs/AddGroupDialog.xaml.cs:
--------------------------------------------------------------------------------
1 | using Img_Share.Controls;
2 | using OneDriveShareImage.Model;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Runtime.InteropServices.WindowsRuntime;
8 | using Tools;
9 | using Windows.Foundation;
10 | using Windows.Foundation.Collections;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Controls.Primitives;
14 | using Windows.UI.Xaml.Data;
15 | using Windows.UI.Xaml.Input;
16 | using Windows.UI.Xaml.Media;
17 | using Windows.UI.Xaml.Navigation;
18 |
19 | // https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“内容对话框”项模板
20 |
21 | namespace Img_Share.Dialogs
22 | {
23 | ///
24 | /// 添加新组
25 | ///
26 | public sealed partial class AddGroupDialog : ContentDialog
27 | {
28 | public AddGroupDialog()
29 | {
30 | this.InitializeComponent();
31 | Title = AppTools.GetReswLanguage("AddGroupTitle");
32 | PrimaryButtonText = AppTools.GetReswLanguage("OK");
33 | SecondaryButtonText = AppTools.GetReswLanguage("Cancel");
34 | }
35 |
36 | private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
37 | {
38 | // 需要检查组名是否为空(或者只包含空格)
39 | // 检查组名是否重复
40 |
41 | args.Cancel = true;
42 | string groupName = GroupInputBox.Text.Trim();
43 | if (!string.IsNullOrEmpty(groupName))
44 | {
45 | bool isIn = App.Db.Groups.Any(p => p.GroupName.ToLower() == groupName.ToLower());
46 | if (!isIn)
47 | {
48 | var group = new OneDriveImageGroup(groupName);
49 | await App.OneDriveTools.AddGroupToDatabase(App.Db, group);
50 | new PopupMaskTip(AppTools.GetReswLanguage("AddGroupSuccess")).Show();
51 | MainPage.Current.GroupCollectionAdd(group);
52 | this.Hide();
53 | return;
54 | }
55 | else
56 | {
57 | new PopupMaskTip(AppTools.GetReswLanguage("GroupNameRepeat")).Show();
58 | }
59 | }
60 | else
61 | {
62 | new PopupMaskTip(AppTools.GetReswLanguage("GroupNameEmpty")).Show();
63 | }
64 | }
65 |
66 | private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
67 | {
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Img_Share/Dialogs/AuthKeyDialog.xaml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Img_Share/Dialogs/AuthKeyDialog.xaml.cs:
--------------------------------------------------------------------------------
1 | using Img_Share.Controls;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Runtime.InteropServices.WindowsRuntime;
7 | using Tools;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.System;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Controls.Primitives;
14 | using Windows.UI.Xaml.Data;
15 | using Windows.UI.Xaml.Input;
16 | using Windows.UI.Xaml.Media;
17 | using Windows.UI.Xaml.Navigation;
18 |
19 | // https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“内容对话框”项模板
20 |
21 | namespace Img_Share.Dialogs
22 | {
23 | ///
24 | /// 添加AuthKey
25 | ///
26 | public sealed partial class AuthKeyDialog : ContentDialog
27 | {
28 | public AuthKeyDialog()
29 | {
30 | this.InitializeComponent();
31 | Title = AppTools.GetReswLanguage("AuthorizeTitle");
32 | TipContentBlock.Text = AppTools.GetReswLanguage("AuthKeyTip");
33 | PrimaryButtonText = AppTools.GetReswLanguage("Authorize");
34 | CloseButtonText = AppTools.GetReswLanguage("Cancel");
35 | }
36 |
37 | private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
38 | {
39 |
40 | }
41 |
42 | private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
43 | {
44 | }
45 |
46 | private async void AuthKeyLinkButton_Click(object sender, RoutedEventArgs e)
47 | {
48 | // 关于获取AuthKey的说明
49 | await Launcher.LaunchUriAsync(new Uri("https://blog.richasy.cn/document/basic/onedrive_authkey.html"));
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Img_Share/Dialogs/GroupDialog.xaml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Img_Share/Dialogs/GroupDialog.xaml.cs:
--------------------------------------------------------------------------------
1 | using OneDriveShareImage.Model;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Collections.ObjectModel;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Runtime.InteropServices.WindowsRuntime;
8 | using Tools;
9 | using Windows.Foundation;
10 | using Windows.Foundation.Collections;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Controls.Primitives;
14 | using Windows.UI.Xaml.Data;
15 | using Windows.UI.Xaml.Input;
16 | using Windows.UI.Xaml.Media;
17 | using Windows.UI.Xaml.Navigation;
18 |
19 | // https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“内容对话框”项模板
20 |
21 | namespace Img_Share.Dialogs
22 | {
23 | ///
24 | /// 用来选择分组的一个弹出框
25 | ///
26 | public sealed partial class GroupDialog : ContentDialog
27 | {
28 | private ObservableCollection GroupCollection = new ObservableCollection();
29 | public OneDriveImageGroup SelectGroup = null;
30 | private bool isInit = false;
31 | public GroupDialog()
32 | {
33 | this.InitializeComponent();
34 | Title = AppTools.GetReswLanguage("GroupDialogTitle");
35 | PrimaryButtonText = AppTools.GetReswLanguage("OK");
36 | SecondaryButtonText = AppTools.GetReswLanguage("Cancel");
37 | var group = App.Db.Groups;
38 | foreach (var item in group)
39 | {
40 | GroupCollection.Add(item);
41 | }
42 | string selectId = AppTools.GetLocalSetting(AppSettings.SelectGroupIndex, "");
43 | foreach (var item in GroupCollection)
44 | {
45 | if (item.GroupId == selectId)
46 | {
47 | GroupCombo.SelectedItem = item;
48 | SelectGroup = item;
49 | }
50 | }
51 | if (SelectGroup == null)
52 | {
53 | GroupCombo.SelectedItem = GroupCollection.First();
54 | SelectGroup = GroupCollection.First();
55 | }
56 | isInit = true;
57 | }
58 |
59 | private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
60 | {
61 | }
62 |
63 | private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
64 | {
65 | }
66 |
67 | private void GroupCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
68 | {
69 | if (isInit)
70 | {
71 | var item = (OneDriveImageGroup)GroupCombo.SelectedItem;
72 | SelectGroup = item;
73 | }
74 |
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Img_Share/Dialogs/TipDialog.xaml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Img_Share/Dialogs/TipDialog.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Tools;
7 | using Windows.Foundation;
8 | using Windows.Foundation.Collections;
9 | using Windows.UI.Xaml;
10 | using Windows.UI.Xaml.Controls;
11 | using Windows.UI.Xaml.Controls.Primitives;
12 | using Windows.UI.Xaml.Data;
13 | using Windows.UI.Xaml.Input;
14 | using Windows.UI.Xaml.Media;
15 | using Windows.UI.Xaml.Navigation;
16 |
17 | // https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“内容对话框”项模板
18 |
19 | namespace Img_Share.Dialogs
20 | {
21 | ///
22 | /// 显示提示内容的弹出框
23 | ///
24 | public sealed partial class TipDialog : ContentDialog
25 | {
26 | public TipDialog()
27 | {
28 | this.InitializeComponent();
29 | }
30 |
31 | public TipDialog(string title,string tip,bool hasPrimary = false):this()
32 | {
33 | Title = title;
34 | TipContentBlock.Text = tip;
35 | if (hasPrimary)
36 | {
37 | PrimaryButtonText = AppTools.GetReswLanguage("OK");
38 | CloseButtonText = AppTools.GetReswLanguage("Cancel");
39 | }
40 | else
41 | {
42 | CloseButtonText = AppTools.GetReswLanguage("OK");
43 | }
44 | }
45 | public TipDialog(string title, string tip, string pr,string sec) : this()
46 | {
47 | Title = title;
48 | TipContentBlock.Text = tip;
49 | PrimaryButtonText = pr;
50 | SecondaryButtonText = sec;
51 | CloseButtonText = AppTools.GetReswLanguage("Cancel");
52 | }
53 |
54 | private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
55 | {
56 | }
57 |
58 | private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
59 | {
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Img_Share/Font/FZLTCHJW.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Font/FZLTCHJW.ttf
--------------------------------------------------------------------------------
/Img_Share/Font/PermanentMarker.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Font/PermanentMarker.ttf
--------------------------------------------------------------------------------
/Img_Share/Font/ShareImg.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Font/ShareImg.ttf
--------------------------------------------------------------------------------
/Img_Share/ImgShare.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/ImgShare.db
--------------------------------------------------------------------------------
/Img_Share/Img_Share.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ShowAllFiles
5 | C:\Users\richasy\Desktop\PictureShare LOGO.png
6 | C:\Users\richasy\Desktop\PictureShare LOGO.png
7 | C:\Users\richasy\Desktop\PictureShare LOGO.png
8 | C:\Users\richasy\Desktop\PictureShare LOGO.png
9 | C:\Users\richasy\Desktop\PictureShare LOGO.png
10 | C:\Users\richasy\Desktop\PictureShare LOGO.png
11 | C:\Users\richasy\Desktop\PictureShare LOGO.png
12 | C:\Users\richasy\Desktop\PictureShare LOGO.png
13 | C:\Users\richasy\Desktop\PictureShare LOGO.png
14 | True
15 | True
16 | x86|x64|arm
17 | False
18 | StoreOnly
19 |
20 |
21 | 30F105C9-681E-420b-A277-7C086EAD8A4E
22 | true
23 |
24 |
25 | true
26 |
27 |
28 | 30F105C9-681E-420b-A277-7C086EAD8A4E
29 | true
30 |
31 |
32 | false
33 |
34 |
--------------------------------------------------------------------------------
/Img_Share/Img_Share_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Richasy/Img-Share/09f712bfbe5dac5a9b4d58980c0454aaabddd9ca/Img_Share/Img_Share_TemporaryKey.pfx
--------------------------------------------------------------------------------
/Img_Share/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
18 |
19 |
20 |
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 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
138 |
139 |
140 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
--------------------------------------------------------------------------------
/Img_Share/Model/KeyValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Runtime.CompilerServices;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Img_Share.Model
10 | {
11 | ///
12 | /// 一个简单的键值对类,修改Value会对UI产生影响
13 | ///
14 | public class KeyValue:INotifyPropertyChanged
15 | {
16 | public string Key { get; set; }
17 |
18 | private string _value { get; set; }
19 | public string Value
20 | {
21 | get => _value;
22 | set { _value = value;OnPropertyChanged(); }
23 | }
24 |
25 | public KeyValue() { }
26 |
27 | public KeyValue(string key,string value)
28 | {
29 | Key = key;
30 | Value = value;
31 | }
32 |
33 | public event PropertyChangedEventHandler PropertyChanged;
34 | public void OnPropertyChanged([CallerMemberName]string propertyName = "")
35 | {
36 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Img_Share/Model/ProgressStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Img_Share.Model
8 | {
9 | ///
10 | /// 进度条类
11 | ///
12 | public class ProgressStatus
13 | {
14 | public int Index { get; set; }
15 | public string Name { get; set; }
16 | public string DisplayName { get; set; }
17 | public bool IsStop { get; set; }
18 | public ProgressStatus()
19 | {
20 |
21 | }
22 |
23 | public ProgressStatus(int index,string name,bool isstop = false)
24 | {
25 | Index = index;
26 | DisplayName = $"[{Index}] {name}";
27 | Name = name;
28 | IsStop = isstop;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Img_Share/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Picture Share
7 | 云之幻
8 | Assets\StoreLogo.png
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Img_Share/Pages/LoginPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Img_Share/Pages/LoginPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using Img_Share.Controls;
2 | using Img_Share.Dialogs;
3 | using System;
4 | using System.Linq;
5 | using Tools;
6 | using Windows.System;
7 | using Windows.UI.Xaml;
8 | using Windows.UI.Xaml.Controls;
9 | using Windows.UI.Xaml.Media.Imaging;
10 |
11 | // https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
12 |
13 | namespace Img_Share.Pages
14 | {
15 | ///
16 | /// 可用于自身或导航至 Frame 内部的空白页。
17 | ///
18 | public sealed partial class LoginPage : Page
19 | {
20 | public LoginPage()
21 | {
22 | this.InitializeComponent();
23 | string theme = App.Current.RequestedTheme.ToString();
24 | var image = new BitmapImage();
25 | image.UriSource = new Uri($"ms-appx:///Assets/{theme}.png");
26 | AppIcon.Source = image;
27 | AppTools.SetTitleBarColorInit(App.Current.RequestedTheme == ApplicationTheme.Dark);
28 | ToolTipService.SetToolTip(OpenSourceButton, AppTools.GetReswLanguage("OpenSourceButton"));
29 | ToolTipService.SetToolTip(UseInfoButton, AppTools.GetReswLanguage("UseInfoButton"));
30 | }
31 |
32 | private async void LinkButton_Click(object sender, RoutedEventArgs e)
33 | {
34 | var tip = new HoldMaskTip(AppTools.GetReswLanguage("WaittingTip"));
35 | tip.Show();
36 | // 开始走OneDrive登录流程
37 | bool isAuth = await App.OneDriveTools.OneDriveAuthorize();
38 |
39 | // 如果用户成功登录并同意授权
40 | if (isAuth)
41 | {
42 | AppTools.WriteLocalSetting(AppSettings.IsOneDriveAuthorized, "True");
43 | // 检查用户云端内是否有图片存储
44 | bool hasCloudMeta = await App.OneDriveTools.EnsureCloudMetaExist();
45 | if (hasCloudMeta)
46 | {
47 | // 有的话进行同步
48 | await App.OneDriveTools.ReplaceDatabase();
49 | App.Db = await App.OneDriveTools.GetImgMetaList();
50 | using (App.Db)
51 | {
52 | if (App.Db.Images.Count() > 0)
53 | {
54 | string url = App.Db.Images.First().URL;
55 | int authKeyIndex = url.IndexOf("key=");
56 | string authkey = url.Substring(authKeyIndex + 4);
57 | AppTools.WriteLocalSetting(AppSettings.AuthKey, authkey);
58 | }
59 | }
60 | }
61 | else
62 | {
63 | // 没有就在应用文件夹里建一个
64 | await App.OneDriveTools.DatabaseInit();
65 |
66 | }
67 | tip.Close();
68 |
69 | // 要求用户输入授权码
70 | string ak = AppTools.GetLocalSetting(AppSettings.AuthKey, "");
71 | if (string.IsNullOrEmpty(ak))
72 | {
73 | // 弹出授权码输入框
74 | bool isCancel = false;
75 | var authDialog = new AuthKeyDialog();
76 | authDialog.PrimaryButtonClick += (_s, _e) =>
77 | {
78 | _e.Cancel = true;
79 | authDialog.IsPrimaryButtonEnabled = false;
80 | string key = authDialog.AuthKeyBox.Text.Trim();
81 | if (string.IsNullOrEmpty(key))
82 | {
83 | var msg = AppTools.GetReswLanguage("AuthKeyEmpty");
84 | new PopupMaskTip(msg).Show();
85 | }
86 | else
87 | {
88 | AppTools.WriteLocalSetting(AppSettings.AuthKey, key);
89 | authDialog.Hide();
90 | }
91 | authDialog.IsPrimaryButtonEnabled = true;
92 | };
93 | authDialog.CloseButtonClick += (_s, _e) =>
94 | {
95 | isCancel = true;
96 | AppTools.WriteLocalSetting(AppSettings.AuthKey, "");
97 | };
98 | await authDialog.ShowAsync();
99 | if (!isCancel)
100 | {
101 | var tipDialog = new TipDialog(AppTools.GetReswLanguage("DefaultTipTitle"), AppTools.GetReswLanguage("AuthorizeSuccess"));
102 | await tipDialog.ShowAsync();
103 | }
104 | else
105 | {
106 | var tipDialog = new TipDialog(AppTools.GetReswLanguage("DefaultTipTitle"), AppTools.GetReswLanguage("AuthorizeCancel"));
107 | await tipDialog.ShowAsync();
108 | }
109 | }
110 | // 跳转至首页
111 | Frame rootFrame = Window.Current.Content as Frame;
112 | AppTools.WriteLocalSetting(AppSettings.IsFirstRun, "False");
113 | rootFrame.Navigate(typeof(MainPage));
114 | }
115 | else
116 | {
117 | tip.Close();
118 | string title = AppTools.GetReswLanguage("AuthErrorTitle");
119 | string content = AppTools.GetReswLanguage("AuthErrorContent");
120 | var dialog = new TipDialog(title, content);
121 | await dialog.ShowAsync();
122 | }
123 |
124 | }
125 |
126 | private async void OpenSourceButton_Click(object sender, RoutedEventArgs e)
127 | {
128 | // 开源地址
129 | await Launcher.LaunchUriAsync(new Uri("https://github.com/Richasy/Img-Share"));
130 | }
131 |
132 | private async void UseInfoButton_Click(object sender, RoutedEventArgs e)
133 | {
134 | // 使用说明
135 | await Launcher.LaunchUriAsync(new Uri("https://www.richasy.cn/document/pictureshare/use.html"));
136 | }
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/Img_Share/Pages/NetErrorPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Img_Share/Pages/NetErrorPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Tools;
3 | using Windows.UI.Xaml;
4 | using Windows.UI.Xaml.Controls;
5 | using Windows.UI.Xaml.Media.Imaging;
6 |
7 | // https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
8 |
9 | namespace Img_Share.Pages
10 | {
11 | ///
12 | /// 网络异常时显示
13 | ///
14 | public sealed partial class NetErrorPage : Page
15 | {
16 | public NetErrorPage()
17 | {
18 | this.InitializeComponent();
19 | string theme = App.Current.RequestedTheme.ToString();
20 | var image = new BitmapImage();
21 | image.UriSource = new Uri($"ms-appx:///Assets/{theme}.png");
22 | AppIcon.Source = image;
23 | AppTools.SetTitleBarColorInit(App.Current.RequestedTheme == ApplicationTheme.Dark);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Img_Share/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Img_Share")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Img_Share")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Img_Share/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Img_Share/Template/Text.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 | /Font/ShareImg.ttf#ShareImg
7 | /Font/FZLTCHJW.ttf#方正兰亭粗黑简体
8 | /Font/PermanentMarker.ttf#Permanent Marker
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Img_Share/Theme/Dark.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Img_Share/Theme/Light.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OneDriveShareImage/Model/ImageDbContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using Tools;
9 | using Windows.Storage;
10 |
11 | namespace OneDriveShareImage.Model
12 | {
13 | ///
14 | /// 图片数据上下文
15 | ///
16 | public class ImageDbContext:DbContext
17 | {
18 | public DbSet Images { get; set; }
19 | public DbSet Groups { get; set; }
20 |
21 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
22 | {
23 | string path = Path.Combine(ApplicationData.Current.LocalFolder.Path, "ImgMeta.db");
24 | //string path = AppTools.GetLocalSetting(AppSettings.DatabasePath, "ImgShare.db");
25 | optionsBuilder.UseSqlite($"Data Source={path}");
26 | }
27 | }
28 |
29 | ///
30 | /// 图片元数据实体类
31 | ///
32 | public class ImageMetaList
33 | {
34 | public List Images { get; set; }
35 | public List Groups { get; set; }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/OneDriveShareImage/Model/OneDriveImage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Windows.Storage;
8 | using Windows.Storage.Streams;
9 | using Windows.UI.Xaml.Media.Imaging;
10 |
11 | namespace OneDriveShareImage.Model
12 | {
13 | ///
14 | /// OneDrive图片实体类
15 | ///
16 | public class OneDriveImage
17 | {
18 | [Required]
19 | public int Id { get; set; }
20 | public string ImageId { get; set; }
21 | public string ImageName { get; set; }
22 | public double Width { get; set; }
23 | public double Height { get; set; }
24 | public string URL { get; set; }
25 | public string GroupId { get; set; }
26 | public string GroupName { get; set; }
27 | public int UploadTime { get; set; }
28 |
29 | public OneDriveImage() { }
30 |
31 | public OneDriveImage(string name,BitmapImage image,OneDriveImageGroup group,string url,string imageId)
32 | {
33 | GroupId = group.GroupId;
34 | GroupName = group.GroupName;
35 | ImageName = name;
36 | Width = image.PixelWidth;
37 | Height = image.PixelHeight;
38 | ImageId = imageId;
39 | URL = url;
40 | TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
41 | UploadTime = Convert.ToInt32(ts.TotalSeconds);
42 | }
43 |
44 | public override bool Equals(object obj)
45 | {
46 | var image = obj as OneDriveImage;
47 | return image != null &&
48 | ImageId == image.ImageId;
49 | }
50 |
51 | public override int GetHashCode()
52 | {
53 | return 1454589903 + EqualityComparer.Default.GetHashCode(ImageId);
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/OneDriveShareImage/Model/OneDriveImageGroup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace OneDriveShareImage.Model
9 | {
10 | ///
11 | /// 图片分组类
12 | ///
13 | public class OneDriveImageGroup
14 | {
15 | [Required]
16 | public int Id { get; set; }
17 | public string GroupId { get; set; }
18 | public string GroupName { get; set; }
19 |
20 | public OneDriveImageGroup() { }
21 |
22 | public OneDriveImageGroup(string name)
23 | {
24 | GroupId = Guid.NewGuid().ToString("N");
25 | GroupName = name;
26 | Id = 0;
27 | }
28 |
29 | public override bool Equals(object obj)
30 | {
31 | var group = obj as OneDriveImageGroup;
32 | return group != null &&
33 | GroupId == group.GroupId;
34 | }
35 |
36 | public override int GetHashCode()
37 | {
38 | return -1221475543 + EqualityComparer.Default.GetHashCode(GroupId);
39 | }
40 |
41 | public override string ToString()
42 | {
43 | return GroupName;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/OneDriveShareImage/OneDriveShareImage.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {406191FE-8C99-4060-BE7D-C74EB49CA6D6}
8 | Library
9 | Properties
10 | OneDriveShareImage
11 | OneDriveShareImage
12 | zh-CN
13 | UAP
14 | 10.0.17763.0
15 | 10.0.16299.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 |
20 |
21 | AnyCPU
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
27 | prompt
28 | 4
29 |
30 |
31 | AnyCPU
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | prompt
37 | 4
38 |
39 |
40 | x86
41 | true
42 | bin\x86\Debug\
43 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
44 | ;2008
45 | full
46 | false
47 | prompt
48 |
49 |
50 | x86
51 | bin\x86\Release\
52 | TRACE;NETFX_CORE;WINDOWS_UWP
53 | true
54 | ;2008
55 | pdbonly
56 | false
57 | prompt
58 |
59 |
60 | ARM
61 | true
62 | bin\ARM\Debug\
63 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
64 | ;2008
65 | full
66 | false
67 | prompt
68 |
69 |
70 | ARM
71 | bin\ARM\Release\
72 | TRACE;NETFX_CORE;WINDOWS_UWP
73 | true
74 | ;2008
75 | pdbonly
76 | false
77 | prompt
78 |
79 |
80 | ARM64
81 | true
82 | bin\ARM64\Debug\
83 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
84 | ;2008
85 | full
86 | false
87 | prompt
88 |
89 |
90 | ARM64
91 | bin\ARM64\Release\
92 | TRACE;NETFX_CORE;WINDOWS_UWP
93 | true
94 | ;2008
95 | pdbonly
96 | false
97 | prompt
98 |
99 |
100 | x64
101 | true
102 | bin\x64\Debug\
103 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
104 | ;2008
105 | full
106 | false
107 | prompt
108 |
109 |
110 | x64
111 | bin\x64\Release\
112 | TRACE;NETFX_CORE;WINDOWS_UWP
113 | true
114 | ;2008
115 | pdbonly
116 | false
117 | prompt
118 |
119 |
120 | PackageReference
121 |
122 |
123 | 4.0
124 | zh-CN
125 | true
126 | true
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 | 2.2.0
139 |
140 |
141 | 2.2.0
142 |
143 |
144 | 2.2.0
145 | runtime; build; native; contentfiles; analyzers
146 | all
147 |
148 |
149 | 6.1.9
150 |
151 |
152 | 5.0.0
153 |
154 |
155 | 11.0.2
156 |
157 |
158 |
159 |
160 | {3c2b25e8-a60f-4493-9bfe-817b581165dd}
161 | Tools
162 |
163 |
164 |
165 | 14.0
166 |
167 |
168 |
169 |
170 |
171 |
172 |
179 |
--------------------------------------------------------------------------------
/OneDriveShareImage/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("OneDriveShareImage")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("OneDriveShareImage")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/OneDriveShareImage/Properties/OneDriveShareImage.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Img Share Open source specification
2 |
3 | > Thanks for [Windows Community Toolkits](https://github.com/windows-toolkit/WindowsCommunityToolkit).
4 | > The OneDrive service they provide is the core component of the software.
5 |
6 | > The original name of the application is **Img Share**. Because it cannot be updated in the Microsoft Store, it is abandoned and a new application called ***Picture Share*** is created.
7 |
8 | ## Function description
9 |
10 | `Img Share` is used to upload pictures to OneDrive and then share the pictures to get links that can be accessed directly. Usually used as embedded pictures for web pages, such as blogging.
11 |
12 | 
13 |
14 | The app is already on the shelf in Microsoft's App Store.
15 |
16 | Here is the address: [Microsoft Store](https://www.microsoft.com/store/productId/9PHWZ3QL0HN3)
17 |
18 | If you want to see the instructions of the software, please click here: [Richasy Blog](https://blog.richasy.cn/document/pictureshare/)
19 |
20 | ## Development environment
21 |
22 | |Key|Value|
23 | |:-|:-|
24 | |System requirements| Windows10-Ver 1803 or upper|
25 | |Development tool|Visual Studio 2017|
26 | |Programing language|C#|
27 | |Display language|Chinese and English|
28 | |Comment language|Chinese|
29 |
30 | ## Deployment instructions
31 |
32 | > Download the whole project, run `Img_Share.sln`, start the project `Img_Share`, and try to see if it works.
33 |
34 | Of course, you can't use **OneDrive** now because you lack `ClientId`.
35 |
36 | Because the software relies on **OneDrive**, you have to apply for an **OneDrive** application [here](https://apps.dev.microsoft.com/
37 | ) before running the whole project. Remember to add the necessary permissions and place the generated `ClientId` at the location of the following path:
38 |
39 | ```
40 | OneDriveShareImage > ShareImageTools.cs > _clientId
41 | ```
42 |
43 | Now, if everything goes well, it should be able to work.
44 |
45 | If you log on to OneDrive and can't pop up the permission list, you may not have added Native App under Platform in your **OneDrive App**.
46 |
47 | ## A hint
48 |
49 | 1. The UI of the software is not bad, maybe it can give you inspiration.
50 | 2. Considering the possibilities of uploading a large number of images, I use Sqlite database as storage. If you don't like it, you can use simple JSON to store data.
51 | 3. If you want to add new functions to the software, you are welcome to submit **Pull Request**.
52 | 4. I hope you **DON'T** duplicate this app on the **Microsoft Store**.
53 | ---
54 |
55 | Thank you for your watching. If you have any questions, please send an email [Thansy@foxmail.com](mailto://thansy@foxmail.com) to inquire.
56 |
57 |
--------------------------------------------------------------------------------
/Tools/AppSettings.cs:
--------------------------------------------------------------------------------
1 | namespace Tools
2 | {
3 | public enum AppSettings
4 | {
5 | ///
6 | /// OneDrive是否授权
7 | ///
8 | IsOneDriveAuthorized,
9 | ///
10 | /// 选择的组ID
11 | ///
12 | SelectGroupIndex,
13 | ///
14 | /// 数据库路径
15 | ///
16 | DatabasePath,
17 | ///
18 | /// 是否是第一次运行
19 | ///
20 | IsFirstRun,
21 | ///
22 | /// 授权码
23 | ///
24 | AuthKey,
25 | ///
26 | /// 数据库是否发生变化
27 | ///
28 | IsDatabaseChanged,
29 | ///
30 | /// 最后同步时间
31 | ///
32 | SyncTime,
33 | ///
34 | /// 文件自动重命名
35 | ///
36 | AutoRename,
37 | }
38 | }
--------------------------------------------------------------------------------
/Tools/AppTools.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.RegularExpressions;
3 | using System.Threading.Tasks;
4 | using Windows.ApplicationModel.Background;
5 | using Windows.ApplicationModel.Core;
6 | using Windows.ApplicationModel.Resources;
7 | using Windows.Storage;
8 | using Windows.UI;
9 | using Windows.UI.ViewManagement;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Media;
12 | using Windows.UI.Xaml.Media.Imaging;
13 |
14 | namespace Tools
15 | {
16 | public class AppTools
17 | {
18 |
19 | ///
20 | /// 写入本地设置
21 | ///
22 | /// 设置名
23 | /// 设置值
24 | public static void WriteLocalSetting(AppSettings key, string value)
25 | {
26 | var localSetting = ApplicationData.Current.LocalSettings;
27 | var localcontainer = localSetting.CreateContainer("Manager", ApplicationDataCreateDisposition.Always);
28 | localcontainer.Values[key.ToString()] = value;
29 | }
30 | ///
31 | /// 读取本地设置
32 | ///
33 | /// 设置名
34 | ///
35 | public static string GetLocalSetting(AppSettings key, string defaultValue)
36 | {
37 | var localSetting = ApplicationData.Current.LocalSettings;
38 | var localcontainer = localSetting.CreateContainer("Manager", ApplicationDataCreateDisposition.Always);
39 | bool isKeyExist = localcontainer.Values.ContainsKey(key.ToString());
40 | if (isKeyExist)
41 | {
42 | return localcontainer.Values[key.ToString()].ToString();
43 | }
44 | else
45 | {
46 | WriteLocalSetting(key, defaultValue);
47 | return defaultValue;
48 | }
49 | }
50 |
51 | ///
52 | /// 将 转化为
53 | ///
54 | /// 获取的图片文件
55 | ///
56 | public async static Task ConvertFileToImage(StorageFile file)
57 | {
58 | var image = new BitmapImage();
59 | using (var stream = await file.OpenReadAsync())
60 | {
61 | await image.SetSourceAsync(stream);
62 | }
63 | return image;
64 | }
65 |
66 | ///
67 | /// 根据语言选项选择对应语言的语句
68 | ///
69 | /// 键值
70 | ///
71 | public static string GetReswLanguage(string name)
72 | {
73 |
74 | var loader = ResourceLoader.GetForCurrentView();
75 | var language = loader.GetString(name);
76 | language = language.Replace("\\n", "\n");
77 | return language;
78 | }
79 | ///
80 | /// 设置标题栏的样式
81 | ///
82 | /// 是否为Dark模式
83 | public static void SetTitleBarColorInit(bool isDark)
84 | {
85 | var view = ApplicationView.GetForCurrentView();
86 | CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
87 | if (isDark)
88 | {
89 | // active
90 | view.TitleBar.BackgroundColor = Colors.Transparent;
91 | view.TitleBar.ForegroundColor = Colors.White;
92 |
93 | // inactive
94 | view.TitleBar.InactiveBackgroundColor = Colors.Transparent;
95 | view.TitleBar.InactiveForegroundColor = Colors.Gray;
96 | // button
97 | view.TitleBar.ButtonBackgroundColor = Colors.Transparent;
98 | view.TitleBar.ButtonForegroundColor = Colors.White;
99 |
100 | view.TitleBar.ButtonHoverBackgroundColor = Color.FromArgb(255, 33, 42, 67);
101 | view.TitleBar.ButtonHoverForegroundColor = Colors.White;
102 |
103 | view.TitleBar.ButtonPressedBackgroundColor = Color.FromArgb(255, 255, 86, 86);
104 | view.TitleBar.ButtonPressedForegroundColor = Colors.White;
105 |
106 | view.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
107 | view.TitleBar.ButtonInactiveForegroundColor = Colors.Gray;
108 | }
109 | else
110 | {
111 | // active
112 | view.TitleBar.BackgroundColor = Colors.Transparent;
113 | view.TitleBar.ForegroundColor = Colors.Black;
114 |
115 | // inactive
116 | view.TitleBar.InactiveBackgroundColor = Colors.Transparent;
117 | view.TitleBar.InactiveForegroundColor = Colors.Gray;
118 | // button
119 | view.TitleBar.ButtonBackgroundColor = Colors.Transparent;
120 | view.TitleBar.ButtonForegroundColor = Colors.DarkGray;
121 |
122 | view.TitleBar.ButtonHoverBackgroundColor = Colors.LightGray;
123 | view.TitleBar.ButtonHoverForegroundColor = Colors.DarkGray;
124 |
125 | view.TitleBar.ButtonPressedBackgroundColor = Colors.DarkGray;
126 | view.TitleBar.ButtonPressedForegroundColor = Colors.White;
127 |
128 | view.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
129 | view.TitleBar.ButtonInactiveForegroundColor = Colors.Gray;
130 | }
131 | }
132 |
133 | ///
134 | /// 获取当前指定的父控件
135 | ///
136 | /// 转换类型
137 | /// 控件
138 | /// 父控件名
139 | ///
140 | public static T GetParentObject(DependencyObject obj, string name) where T : FrameworkElement
141 | {
142 | DependencyObject parent = VisualTreeHelper.GetParent(obj);
143 |
144 | while (parent != null)
145 | {
146 | if (parent is T && (((T)parent).Name == name | string.IsNullOrEmpty(name)))
147 | {
148 | return (T)parent;
149 | }
150 |
151 | parent = VisualTreeHelper.GetParent(parent);
152 | }
153 |
154 | return null;
155 | }
156 | ///
157 | /// 获取当前控件的指定子控件
158 | ///
159 | /// 控件类型
160 | /// 父控件
161 | /// 子控件名
162 | ///
163 | public static T GetChildObject(DependencyObject obj, string name) where T : FrameworkElement
164 | {
165 | DependencyObject child = null;
166 | T grandChild = null;
167 |
168 | for (int i = 0; i <= VisualTreeHelper.GetChildrenCount(obj) - 1; i++)
169 | {
170 | child = VisualTreeHelper.GetChild(obj, i);
171 |
172 | if (child is T && (((T)child).Name == name | string.IsNullOrEmpty(name)))
173 | {
174 | return (T)child;
175 | }
176 | else
177 | {
178 | grandChild = GetChildObject(child, name);
179 | }
180 | if (grandChild != null)
181 | {
182 | return grandChild;
183 | }
184 | }
185 | return null;
186 | }
187 |
188 | ///
189 | /// 标准化字符串,去掉空格,全部小写
190 | ///
191 | /// 字符串
192 | ///
193 | public static string NormalString(string str)
194 | {
195 | str = str.ToLower();
196 | var reg = new Regex(@"\s", RegexOptions.IgnoreCase);
197 | str = reg.Replace(str, "");
198 | return str;
199 | }
200 |
201 | ///
202 | /// 后台任务注册
203 | ///
204 | /// 后台任务是否注册
205 | /// 后台任务注册许可
206 | /// 后台任务名
207 | /// 后台任务入口
208 | /// 后台任务触发条件
209 | public static void BackgroundTaskReg(bool isTaskReg, bool isCanReg, string TaskName, string EntryPoint, TimeTrigger trigger)
210 | {
211 | if (!isTaskReg && isCanReg)
212 | {
213 | var builder = new BackgroundTaskBuilder
214 | {
215 | Name = TaskName,
216 | TaskEntryPoint = EntryPoint
217 | };
218 | builder.SetTrigger(trigger);
219 | BackgroundTaskRegistration task = builder.Register();
220 | }
221 | else if (!isCanReg)
222 | {
223 | foreach (var item in BackgroundTaskRegistration.AllTasks)
224 | {
225 | if (item.Value.Name == TaskName)
226 | {
227 | item.Value.Unregister(true);
228 | }
229 | }
230 | }
231 | }
232 | }
233 | }
234 |
--------------------------------------------------------------------------------
/Tools/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Tools")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Tools")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Tools/Properties/Tools.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Tools/Tools.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {3C2B25E8-A60F-4493-9BFE-817B581165DD}
8 | Library
9 | Properties
10 | Tools
11 | Tools
12 | zh-CN
13 | UAP
14 | 10.0.17763.0
15 | 10.0.16299.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 |
20 |
21 | AnyCPU
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
27 | prompt
28 | 4
29 |
30 |
31 | AnyCPU
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | prompt
37 | 4
38 |
39 |
40 | x86
41 | true
42 | bin\x86\Debug\
43 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
44 | ;2008
45 | full
46 | false
47 | prompt
48 |
49 |
50 | x86
51 | bin\x86\Release\
52 | TRACE;NETFX_CORE;WINDOWS_UWP
53 | true
54 | ;2008
55 | pdbonly
56 | false
57 | prompt
58 |
59 |
60 | ARM
61 | true
62 | bin\ARM\Debug\
63 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
64 | ;2008
65 | full
66 | false
67 | prompt
68 |
69 |
70 | ARM
71 | bin\ARM\Release\
72 | TRACE;NETFX_CORE;WINDOWS_UWP
73 | true
74 | ;2008
75 | pdbonly
76 | false
77 | prompt
78 |
79 |
80 | ARM64
81 | true
82 | bin\ARM64\Debug\
83 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
84 | ;2008
85 | full
86 | false
87 | prompt
88 |
89 |
90 | ARM64
91 | bin\ARM64\Release\
92 | TRACE;NETFX_CORE;WINDOWS_UWP
93 | true
94 | ;2008
95 | pdbonly
96 | false
97 | prompt
98 |
99 |
100 | x64
101 | true
102 | bin\x64\Debug\
103 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
104 | ;2008
105 | full
106 | false
107 | prompt
108 |
109 |
110 | x64
111 | bin\x64\Release\
112 | TRACE;NETFX_CORE;WINDOWS_UWP
113 | true
114 | ;2008
115 | pdbonly
116 | false
117 | prompt
118 |
119 |
120 | PackageReference
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 | 6.1.9
131 |
132 |
133 |
134 | 14.0
135 |
136 |
137 |
144 |
--------------------------------------------------------------------------------