├── .gitattributes
├── .gitignore
├── Fluentpad.Core
├── Fluentpad.Core.csproj
├── Helpers
│ ├── Json.cs
│ └── Singleton.cs
└── readme.txt
├── Fluentpad.sln
├── Fluentpad
├── .editorconfig
├── Activation
│ ├── ActivationHandler.cs
│ ├── CommandLineActivationHandler.cs
│ └── DefaultActivationHandler.cs
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── LockScreenLogo.scale-200.png
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ └── Wide310x150Logo.scale-200.png
├── Fluentpad.csproj
├── Helpers
│ ├── EnumToBooleanConverter.cs
│ ├── ResourceExtensions.cs
│ └── SettingsStorageExtensions.cs
├── Package.appxmanifest
├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── Services
│ ├── ActivationService.cs
│ ├── FirstRunDisplayService.cs
│ ├── NavigationService.cs
│ ├── ThemeSelectorService.cs
│ └── WhatsNewDisplayService.cs
├── Strings
│ └── en-us
│ │ └── Resources.resw
├── Styles
│ ├── Page.xaml
│ ├── PlainTextBoxxaml.xaml
│ ├── TextBlock.xaml
│ ├── _Colors.xaml
│ ├── _FontSizes.xaml
│ └── _Thickness.xaml
└── Views
│ ├── CmdLineActivationSamplePage.xaml
│ ├── CmdLineActivationSamplePage.xaml.cs
│ ├── FirstRunDialog.xaml
│ ├── FirstRunDialog.xaml.cs
│ ├── MarkdownViewPage.xaml
│ ├── MarkdownViewPage.xaml.cs
│ ├── PlantxtViewPage.xaml
│ ├── PlantxtViewPage.xaml.cs
│ ├── RichViewPage.xaml
│ ├── RichViewPage.xaml.cs
│ ├── SettingsPage.xaml
│ ├── SettingsPage.xaml.cs
│ ├── TabsPage.xaml
│ ├── TabsPage.xaml.cs
│ ├── WhatsNewDialog.xaml
│ └── WhatsNewDialog.xaml.cs
└── LICENSE
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | [Aa][Rr][Mm]/
24 | [Aa][Rr][Mm]64/
25 | bld/
26 | [Bb]in/
27 | [Oo]bj/
28 | [Ll]og/
29 |
30 | # Visual Studio 2015/2017 cache/options directory
31 | .vs/
32 | # Uncomment if you have tasks that create the project's static files in wwwroot
33 | #wwwroot/
34 |
35 | # Visual Studio 2017 auto generated files
36 | Generated\ Files/
37 |
38 | # MSTest test Results
39 | [Tt]est[Rr]esult*/
40 | [Bb]uild[Ll]og.*
41 |
42 | # NUNIT
43 | *.VisualState.xml
44 | TestResult.xml
45 |
46 | # Build Results of an ATL Project
47 | [Dd]ebugPS/
48 | [Rr]eleasePS/
49 | dlldata.c
50 |
51 | # Benchmark Results
52 | BenchmarkDotNet.Artifacts/
53 |
54 | # .NET Core
55 | project.lock.json
56 | project.fragment.lock.json
57 | artifacts/
58 |
59 | # StyleCop
60 | StyleCopReport.xml
61 |
62 | # Files built by Visual Studio
63 | *_i.c
64 | *_p.c
65 | *_h.h
66 | *.ilk
67 | *.meta
68 | *.obj
69 | *.iobj
70 | *.pch
71 | *.pdb
72 | *.ipdb
73 | *.pgc
74 | *.pgd
75 | *.rsp
76 | *.sbr
77 | *.tlb
78 | *.tli
79 | *.tlh
80 | *.tmp
81 | *.tmp_proj
82 | *_wpftmp.csproj
83 | *.log
84 | *.vspscc
85 | *.vssscc
86 | .builds
87 | *.pidb
88 | *.svclog
89 | *.scc
90 |
91 | # Chutzpah Test files
92 | _Chutzpah*
93 |
94 | # Visual C++ cache files
95 | ipch/
96 | *.aps
97 | *.ncb
98 | *.opendb
99 | *.opensdf
100 | *.sdf
101 | *.cachefile
102 | *.VC.db
103 | *.VC.VC.opendb
104 |
105 | # Visual Studio profiler
106 | *.psess
107 | *.vsp
108 | *.vspx
109 | *.sap
110 |
111 | # Visual Studio Trace Files
112 | *.e2e
113 |
114 | # TFS 2012 Local Workspace
115 | $tf/
116 |
117 | # Guidance Automation Toolkit
118 | *.gpState
119 |
120 | # ReSharper is a .NET coding add-in
121 | _ReSharper*/
122 | *.[Rr]e[Ss]harper
123 | *.DotSettings.user
124 |
125 | # JustCode is a .NET coding add-in
126 | .JustCode
127 |
128 | # TeamCity is a build add-in
129 | _TeamCity*
130 |
131 | # DotCover is a Code Coverage Tool
132 | *.dotCover
133 |
134 | # AxoCover is a Code Coverage Tool
135 | .axoCover/*
136 | !.axoCover/settings.json
137 |
138 | # Visual Studio code coverage results
139 | *.coverage
140 | *.coveragexml
141 |
142 | # NCrunch
143 | _NCrunch_*
144 | .*crunch*.local.xml
145 | nCrunchTemp_*
146 |
147 | # MightyMoose
148 | *.mm.*
149 | AutoTest.Net/
150 |
151 | # Web workbench (sass)
152 | .sass-cache/
153 |
154 | # Installshield output folder
155 | [Ee]xpress/
156 |
157 | # DocProject is a documentation generator add-in
158 | DocProject/buildhelp/
159 | DocProject/Help/*.HxT
160 | DocProject/Help/*.HxC
161 | DocProject/Help/*.hhc
162 | DocProject/Help/*.hhk
163 | DocProject/Help/*.hhp
164 | DocProject/Help/Html2
165 | DocProject/Help/html
166 |
167 | # Click-Once directory
168 | publish/
169 |
170 | # Publish Web Output
171 | *.[Pp]ublish.xml
172 | *.azurePubxml
173 | # Note: Comment the next line if you want to checkin your web deploy settings,
174 | # but database connection strings (with potential passwords) will be unencrypted
175 | *.pubxml
176 | *.publishproj
177 |
178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
179 | # checkin your Azure Web App publish settings, but sensitive information contained
180 | # in these scripts will be unencrypted
181 | PublishScripts/
182 |
183 | # NuGet Packages
184 | *.nupkg
185 | # The packages folder can be ignored because of Package Restore
186 | **/[Pp]ackages/*
187 | # except build/, which is used as an MSBuild target.
188 | !**/[Pp]ackages/build/
189 | # Uncomment if necessary however generally it will be regenerated when needed
190 | #!**/[Pp]ackages/repositories.config
191 | # NuGet v3's project.json files produces more ignorable files
192 | *.nuget.props
193 | *.nuget.targets
194 |
195 | # Microsoft Azure Build Output
196 | csx/
197 | *.build.csdef
198 |
199 | # Microsoft Azure Emulator
200 | ecf/
201 | rcf/
202 |
203 | # Windows Store app package directories and files
204 | AppPackages/
205 | BundleArtifacts/
206 | Package.StoreAssociation.xml
207 | _pkginfo.txt
208 | *.appx
209 |
210 | # Visual Studio cache files
211 | # files ending in .cache can be ignored
212 | *.[Cc]ache
213 | # but keep track of directories ending in .cache
214 | !?*.[Cc]ache/
215 |
216 | # Others
217 | ClientBin/
218 | ~$*
219 | *~
220 | *.dbmdl
221 | *.dbproj.schemaview
222 | *.jfm
223 | *.pfx
224 | *.publishsettings
225 | orleans.codegen.cs
226 |
227 | # Including strong name files can present a security risk
228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
229 | #*.snk
230 |
231 | # Since there are multiple workflows, uncomment next line to ignore bower_components
232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
233 | #bower_components/
234 |
235 | # RIA/Silverlight projects
236 | Generated_Code/
237 |
238 | # Backup & report files from converting an old project file
239 | # to a newer Visual Studio version. Backup files are not needed,
240 | # because we have git ;-)
241 | _UpgradeReport_Files/
242 | Backup*/
243 | UpgradeLog*.XML
244 | UpgradeLog*.htm
245 | ServiceFabricBackup/
246 | *.rptproj.bak
247 |
248 | # SQL Server files
249 | *.mdf
250 | *.ldf
251 | *.ndf
252 |
253 | # Business Intelligence projects
254 | *.rdl.data
255 | *.bim.layout
256 | *.bim_*.settings
257 | *.rptproj.rsuser
258 | *- Backup*.rdl
259 |
260 | # Microsoft Fakes
261 | FakesAssemblies/
262 |
263 | # GhostDoc plugin setting file
264 | *.GhostDoc.xml
265 |
266 | # Node.js Tools for Visual Studio
267 | .ntvs_analysis.dat
268 | node_modules/
269 |
270 | # Visual Studio 6 build log
271 | *.plg
272 |
273 | # Visual Studio 6 workspace options file
274 | *.opt
275 |
276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
277 | *.vbw
278 |
279 | # Visual Studio LightSwitch build output
280 | **/*.HTMLClient/GeneratedArtifacts
281 | **/*.DesktopClient/GeneratedArtifacts
282 | **/*.DesktopClient/ModelManifest.xml
283 | **/*.Server/GeneratedArtifacts
284 | **/*.Server/ModelManifest.xml
285 | _Pvt_Extensions
286 |
287 | # Paket dependency manager
288 | .paket/paket.exe
289 | paket-files/
290 |
291 | # FAKE - F# Make
292 | .fake/
293 |
294 | # JetBrains Rider
295 | .idea/
296 | *.sln.iml
297 |
298 | # CodeRush personal settings
299 | .cr/personal
300 |
301 | # Python Tools for Visual Studio (PTVS)
302 | __pycache__/
303 | *.pyc
304 |
305 | # Cake - Uncomment if you are using it
306 | # tools/**
307 | # !tools/packages.config
308 |
309 | # Tabs Studio
310 | *.tss
311 |
312 | # Telerik's JustMock configuration file
313 | *.jmconfig
314 |
315 | # BizTalk build output
316 | *.btp.cs
317 | *.btm.cs
318 | *.odx.cs
319 | *.xsd.cs
320 |
321 | # OpenCover UI analysis results
322 | OpenCover/
323 |
324 | # Azure Stream Analytics local run output
325 | ASALocalRun/
326 |
327 | # MSBuild Binary and Structured Log
328 | *.binlog
329 |
330 | # NVidia Nsight GPU debugger configuration file
331 | *.nvuser
332 |
333 | # MFractors (Xamarin productivity tool) working folder
334 | .mfractor/
335 |
336 | # Local History for Visual Studio
337 | .localhistory/
338 |
339 | # BeatPulse healthcheck temp database
340 | healthchecksdb
--------------------------------------------------------------------------------
/Fluentpad.Core/Fluentpad.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Fluentpad.Core
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Fluentpad.Core/Helpers/Json.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | using Newtonsoft.Json;
5 |
6 | namespace Fluentpad.Core.Helpers
7 | {
8 | public static class Json
9 | {
10 | public static async Task ToObjectAsync(string value)
11 | {
12 | return await Task.Run(() =>
13 | {
14 | return JsonConvert.DeserializeObject(value);
15 | });
16 | }
17 |
18 | public static async Task StringifyAsync(object value)
19 | {
20 | return await Task.Run(() =>
21 | {
22 | return JsonConvert.SerializeObject(value);
23 | });
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Fluentpad.Core/Helpers/Singleton.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 |
4 | namespace Fluentpad.Core.Helpers
5 | {
6 | public static class Singleton
7 | where T : new()
8 | {
9 | private static ConcurrentDictionary _instances = new ConcurrentDictionary();
10 |
11 | public static T Instance
12 | {
13 | get
14 | {
15 | return _instances.GetOrAdd(typeof(T), (t) => new T());
16 | }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Fluentpad.Core/readme.txt:
--------------------------------------------------------------------------------
1 | This core project is a .net standard project.
2 | It's a great place to put all your logic that is not platform dependent (e.g. model/helper classes) so they can be reused.
--------------------------------------------------------------------------------
/Fluentpad.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29905.134
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fluentpad", "Fluentpad\Fluentpad.csproj", "{1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fluentpad.Core", "Fluentpad.Core\Fluentpad.Core.csproj", "{09984C7C-1D4A-4A13-8085-C24052FE678A}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Debug|ARM = Debug|ARM
14 | Debug|ARM64 = Debug|ARM64
15 | Debug|x64 = Debug|x64
16 | Debug|x86 = Debug|x86
17 | Release|Any CPU = Release|Any CPU
18 | Release|ARM = Release|ARM
19 | Release|ARM64 = Release|ARM64
20 | Release|x64 = Release|x64
21 | Release|x86 = Release|x86
22 | EndGlobalSection
23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
24 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|Any CPU.ActiveCfg = Debug|x86
25 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|ARM.ActiveCfg = Debug|ARM
26 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|ARM.Build.0 = Debug|ARM
27 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|ARM.Deploy.0 = Debug|ARM
28 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|ARM64.ActiveCfg = Debug|ARM64
29 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|ARM64.Build.0 = Debug|ARM64
30 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|ARM64.Deploy.0 = Debug|ARM64
31 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|x64.ActiveCfg = Debug|x64
32 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|x64.Build.0 = Debug|x64
33 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|x64.Deploy.0 = Debug|x64
34 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|x86.ActiveCfg = Debug|x86
35 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|x86.Build.0 = Debug|x86
36 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Debug|x86.Deploy.0 = Debug|x86
37 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|Any CPU.ActiveCfg = Release|x86
38 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|ARM.ActiveCfg = Release|ARM
39 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|ARM.Build.0 = Release|ARM
40 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|ARM.Deploy.0 = Release|ARM
41 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|ARM64.ActiveCfg = Release|ARM64
42 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|ARM64.Build.0 = Release|ARM64
43 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|ARM64.Deploy.0 = Release|ARM64
44 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|x64.ActiveCfg = Release|x64
45 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|x64.Build.0 = Release|x64
46 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|x64.Deploy.0 = Release|x64
47 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|x86.ActiveCfg = Release|x86
48 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|x86.Build.0 = Release|x86
49 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}.Release|x86.Deploy.0 = Release|x86
50 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Debug|Any CPU.Build.0 = Debug|Any CPU
52 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Debug|ARM.ActiveCfg = Debug|Any CPU
53 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Debug|ARM.Build.0 = Debug|Any CPU
54 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Debug|ARM64.ActiveCfg = Debug|Any CPU
55 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Debug|ARM64.Build.0 = Debug|Any CPU
56 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Debug|x64.ActiveCfg = Debug|Any CPU
57 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Debug|x64.Build.0 = Debug|Any CPU
58 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Debug|x86.ActiveCfg = Debug|Any CPU
59 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Debug|x86.Build.0 = Debug|Any CPU
60 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Release|Any CPU.ActiveCfg = Release|Any CPU
61 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Release|Any CPU.Build.0 = Release|Any CPU
62 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Release|ARM.ActiveCfg = Release|Any CPU
63 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Release|ARM.Build.0 = Release|Any CPU
64 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Release|ARM64.ActiveCfg = Release|Any CPU
65 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Release|ARM64.Build.0 = Release|Any CPU
66 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Release|x64.ActiveCfg = Release|Any CPU
67 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Release|x64.Build.0 = Release|Any CPU
68 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Release|x86.ActiveCfg = Release|Any CPU
69 | {09984C7C-1D4A-4A13-8085-C24052FE678A}.Release|x86.Build.0 = Release|Any CPU
70 | EndGlobalSection
71 | GlobalSection(SolutionProperties) = preSolution
72 | HideSolutionNode = FALSE
73 | EndGlobalSection
74 | GlobalSection(ExtensibilityGlobals) = postSolution
75 | SolutionGuid = {12A22E61-CB4F-4817-AD74-2A5F11BD313D}
76 | EndGlobalSection
77 | EndGlobal
78 |
--------------------------------------------------------------------------------
/Fluentpad/.editorconfig:
--------------------------------------------------------------------------------
1 | # top-most EditorConfig file
2 | root = true
3 |
4 | [*]
5 | end_of_line = crlf
6 |
7 | [*.{cs,xaml}]
8 | indent_style = space
9 | indent_size = 4
10 | trim_trailing_whitespace = true
11 | insert_final_newline = true
12 |
--------------------------------------------------------------------------------
/Fluentpad/Activation/ActivationHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | namespace Fluentpad.Activation
5 | {
6 | // For more information on understanding and extending activation flow see
7 | // https://github.com/Microsoft/WindowsTemplateStudio/blob/master/docs/UWP/activation.md
8 | internal abstract class ActivationHandler
9 | {
10 | public abstract bool CanHandle(object args);
11 |
12 | public abstract Task HandleAsync(object args);
13 | }
14 |
15 | // Extend this class to implement new ActivationHandlers
16 | internal abstract class ActivationHandler : ActivationHandler
17 | where T : class
18 | {
19 | // Override this method to add the activation logic in your activation handler
20 | protected abstract Task HandleInternalAsync(T args);
21 |
22 | public override async Task HandleAsync(object args)
23 | {
24 | await HandleInternalAsync(args as T);
25 | }
26 |
27 | public override bool CanHandle(object args)
28 | {
29 | // CanHandle checks the args is of type you have configured
30 | return args is T && CanHandleInternal(args as T);
31 | }
32 |
33 | // You can override this method to add extra validation on activation args
34 | // to determine if your ActivationHandler should handle this activation args
35 | protected virtual bool CanHandleInternal(T args)
36 | {
37 | return true;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Fluentpad/Activation/CommandLineActivationHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Threading.Tasks;
3 |
4 | using Fluentpad.Services;
5 | using Fluentpad.Views;
6 |
7 | using Windows.ApplicationModel.Activation;
8 | using Windows.ApplicationModel.Core;
9 | using Windows.UI.Xaml;
10 | using Windows.UI.Xaml.Controls;
11 |
12 | namespace Fluentpad.Activation
13 | {
14 | internal class CommandLineActivationHandler : ActivationHandler
15 | {
16 | // Learn more about these EventArgs at https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.activation.commandlineactivatedeventargs
17 | protected override async Task HandleInternalAsync(CommandLineActivatedEventArgs args)
18 | {
19 | CommandLineActivationOperation operation = args.Operation;
20 |
21 | // Because these are supplied by the caller, they should be treated as untrustworthy.
22 | string cmdLineString = operation.Arguments;
23 |
24 | // The directory where the command-line activation request was made.
25 | // This is typically not the install location of the app itself, but could be any arbitrary path.
26 | string activationPath = operation.CurrentDirectoryPath;
27 |
28 | //// TODO WTS: parse the cmdLineString to determine what to do.
29 | //// If doing anything async, get a deferral first.
30 | //// using (var deferral = operation.GetDeferral())
31 | //// {
32 | //// await ParseCmdString(cmdLineString, activationPath);
33 | //// }
34 | ////
35 | //// If the arguments warrant showing a different view on launch, that can be done here.
36 | //// NavigationService.Navigate(typeof(CmdLineActivationSamplePage), cmdLineString);
37 | //// If you do nothing, the app will launch like normal.
38 |
39 | await Task.CompletedTask;
40 | }
41 |
42 | protected override bool CanHandleInternal(CommandLineActivatedEventArgs args)
43 | {
44 | // Only handle a commandline launch if arguments are passed.
45 | return args?.Operation.Arguments.Any() ?? false;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Fluentpad/Activation/DefaultActivationHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | using Fluentpad.Services;
5 |
6 | using Windows.ApplicationModel.Activation;
7 |
8 | namespace Fluentpad.Activation
9 | {
10 | internal class DefaultActivationHandler : ActivationHandler
11 | {
12 | private readonly Type _navElement;
13 |
14 | public DefaultActivationHandler(Type navElement)
15 | {
16 | _navElement = navElement;
17 | }
18 |
19 | protected override async Task HandleInternalAsync(IActivatedEventArgs args)
20 | {
21 | // When the navigation stack isn't restored, navigate to the first page and configure
22 | // the new page by passing required information in the navigation parameter
23 | object arguments = null;
24 | if (args is LaunchActivatedEventArgs launchArgs)
25 | {
26 | arguments = launchArgs.Arguments;
27 | }
28 |
29 | NavigationService.Navigate(_navElement, arguments);
30 | await Task.CompletedTask;
31 | }
32 |
33 | protected override bool CanHandleInternal(IActivatedEventArgs args)
34 | {
35 | // None of the ActivationHandlers has handled the app activation
36 | return NavigationService.Frame.Content == null && _navElement != null;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Fluentpad/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Fluentpad/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Fluentpad.Services;
4 |
5 | using Windows.ApplicationModel.Activation;
6 | using Windows.UI.Xaml;
7 |
8 | namespace Fluentpad
9 | {
10 | public sealed partial class App : Application
11 | {
12 | private Lazy _activationService;
13 |
14 | private ActivationService ActivationService
15 | {
16 | get { return _activationService.Value; }
17 | }
18 |
19 | public App()
20 | {
21 | InitializeComponent();
22 |
23 | // Deferred execution until used. Check https://msdn.microsoft.com/library/dd642331(v=vs.110).aspx for further info on Lazy class.
24 | _activationService = new Lazy(CreateActivationService);
25 | }
26 |
27 | protected override async void OnLaunched(LaunchActivatedEventArgs args)
28 | {
29 | if (!args.PrelaunchActivated)
30 | {
31 | await ActivationService.ActivateAsync(args);
32 | }
33 | }
34 |
35 | protected override async void OnActivated(IActivatedEventArgs args)
36 | {
37 | await ActivationService.ActivateAsync(args);
38 | }
39 |
40 | private ActivationService CreateActivationService()
41 | {
42 | return new ActivationService(this, typeof(Views.TabsPage));
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Fluentpad/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FireCubeStudios/Fluentpad/3cfca5735f56e69c6eb2009173d0895297ded5a4/Fluentpad/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Fluentpad/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FireCubeStudios/Fluentpad/3cfca5735f56e69c6eb2009173d0895297ded5a4/Fluentpad/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Fluentpad/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FireCubeStudios/Fluentpad/3cfca5735f56e69c6eb2009173d0895297ded5a4/Fluentpad/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Fluentpad/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FireCubeStudios/Fluentpad/3cfca5735f56e69c6eb2009173d0895297ded5a4/Fluentpad/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Fluentpad/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FireCubeStudios/Fluentpad/3cfca5735f56e69c6eb2009173d0895297ded5a4/Fluentpad/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Fluentpad/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FireCubeStudios/Fluentpad/3cfca5735f56e69c6eb2009173d0895297ded5a4/Fluentpad/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Fluentpad/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FireCubeStudios/Fluentpad/3cfca5735f56e69c6eb2009173d0895297ded5a4/Fluentpad/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Fluentpad/Fluentpad.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | {1BBB07F0-EF9E-44C7-9BC0-50CB0C1ED0AD}
8 | AppContainerExe
9 | Properties
10 | Fluentpad
11 | Fluentpad
12 | en-US
13 | UAP
14 | 10.0.18362.0
15 | 10.0.18362.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | true
20 | Fluentpad_TemporaryKey.pfx
21 |
22 |
23 | true
24 | bin\x86\Debug\
25 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
26 | ;2008
27 | full
28 | x86
29 | false
30 | prompt
31 | true
32 |
33 |
34 | bin\x86\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | true
37 | ;2008
38 | pdbonly
39 | x86
40 | false
41 | prompt
42 | true
43 | true
44 |
45 |
46 | true
47 | bin\ARM\Debug\
48 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
49 | ;2008
50 | full
51 | ARM
52 | false
53 | prompt
54 | true
55 |
56 |
57 | bin\ARM\Release\
58 | TRACE;NETFX_CORE;WINDOWS_UWP
59 | true
60 | ;2008
61 | pdbonly
62 | ARM
63 | false
64 | prompt
65 | true
66 | true
67 |
68 |
69 | true
70 | bin\ARM64\Debug\
71 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
72 | ;2008
73 | full
74 | ARM64
75 | false
76 | prompt
77 | true
78 | true
79 |
80 |
81 | bin\ARM64\Release\
82 | TRACE;NETFX_CORE;WINDOWS_UWP
83 | true
84 | ;2008
85 | pdbonly
86 | ARM64
87 | false
88 | prompt
89 | true
90 | true
91 |
92 |
93 | true
94 | bin\x64\Debug\
95 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
96 | ;2008
97 | full
98 | x64
99 | false
100 | prompt
101 | true
102 |
103 |
104 | bin\x64\Release\
105 | TRACE;NETFX_CORE;WINDOWS_UWP
106 | true
107 | ;2008
108 | pdbonly
109 | x64
110 | false
111 | prompt
112 | true
113 | true
114 |
115 |
116 | PackageReference
117 |
118 |
119 |
120 | 6.2.9
121 |
122 |
123 | 10.1901.28001
124 |
125 |
126 | 6.0.0
127 |
128 |
129 | 6.1.0
130 |
131 |
132 | 2.4.2
133 |
134 |
135 | 2.0.1
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 | CmdLineActivationSamplePage.xaml
154 |
155 |
156 | FirstRunDialog.xaml
157 |
158 |
159 | MarkdownViewPage.xaml
160 |
161 |
162 | PlantxtViewPage.xaml
163 |
164 |
165 | RichViewPage.xaml
166 |
167 |
168 | SettingsPage.xaml
169 |
170 |
171 | TabsPage.xaml
172 |
173 |
174 | WhatsNewDialog.xaml
175 |
176 |
177 |
178 |
179 | App.xaml
180 |
181 |
182 |
183 |
184 |
185 | MSBuild:Compile
186 | Designer
187 |
188 |
189 | Designer
190 | MSBuild:Compile
191 |
192 |
193 | Designer
194 | MSBuild:Compile
195 |
196 |
197 | Designer
198 | MSBuild:Compile
199 |
200 |
201 | Designer
202 | MSBuild:Compile
203 |
204 |
205 | Designer
206 | MSBuild:Compile
207 |
208 |
209 | MSBuild:Compile
210 | Designer
211 |
212 |
213 | MSBuild:Compile
214 | Designer
215 |
216 |
217 | MSBuild:Compile
218 | Designer
219 |
220 |
221 | MSBuild:Compile
222 | Designer
223 |
224 |
225 | MSBuild:Compile
226 | Designer
227 |
228 |
229 | MSBuild:Compile
230 | Designer
231 |
232 |
233 | MSBuild:Compile
234 | Designer
235 |
236 |
237 | MSBuild:Compile
238 | Designer
239 |
240 |
241 |
242 |
243 | Designer
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 | MSBuild:Compile
266 | Designer
267 |
268 |
269 |
270 |
271 | Microsoft Engagement Framework
272 |
273 |
274 | Visual C++ 2015 Runtime for Universal Windows Platform Apps
275 |
276 |
277 |
278 |
279 | {09984C7C-1D4A-4A13-8085-C24052FE678A}
280 | Fluentpad.Core
281 |
282 |
283 |
284 | 14.0
285 |
286 |
287 |
294 |
--------------------------------------------------------------------------------
/Fluentpad/Helpers/EnumToBooleanConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Windows.UI.Xaml.Data;
4 |
5 | namespace Fluentpad.Helpers
6 | {
7 | public class EnumToBooleanConverter : IValueConverter
8 | {
9 | public Type EnumType { get; set; }
10 |
11 | public object Convert(object value, Type targetType, object parameter, string language)
12 | {
13 | if (parameter is string enumString)
14 | {
15 | if (!Enum.IsDefined(EnumType, value))
16 | {
17 | throw new ArgumentException("ExceptionEnumToBooleanConverterValueMustBeAnEnum".GetLocalized());
18 | }
19 |
20 | var enumValue = Enum.Parse(EnumType, enumString);
21 |
22 | return enumValue.Equals(value);
23 | }
24 |
25 | throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName".GetLocalized());
26 | }
27 |
28 | public object ConvertBack(object value, Type targetType, object parameter, string language)
29 | {
30 | if (parameter is string enumString)
31 | {
32 | return Enum.Parse(EnumType, enumString);
33 | }
34 |
35 | throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName".GetLocalized());
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Fluentpad/Helpers/ResourceExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | using Windows.ApplicationModel.Resources;
5 |
6 | namespace Fluentpad.Helpers
7 | {
8 | internal static class ResourceExtensions
9 | {
10 | private static ResourceLoader _resLoader = new ResourceLoader();
11 |
12 | public static string GetLocalized(this string resourceKey)
13 | {
14 | return _resLoader.GetString(resourceKey);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Fluentpad/Helpers/SettingsStorageExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Threading.Tasks;
4 |
5 | using Fluentpad.Core.Helpers;
6 |
7 | using Windows.Storage;
8 | using Windows.Storage.Streams;
9 |
10 | namespace Fluentpad.Helpers
11 | {
12 | // Use these extension methods to store and retrieve local and roaming app data
13 | // More details regarding storing and retrieving app data at https://docs.microsoft.com/windows/uwp/app-settings/store-and-retrieve-app-data
14 | public static class SettingsStorageExtensions
15 | {
16 | private const string FileExtension = ".json";
17 |
18 | public static bool IsRoamingStorageAvailable(this ApplicationData appData)
19 | {
20 | return appData.RoamingStorageQuota == 0;
21 | }
22 |
23 | public static async Task SaveAsync(this StorageFolder folder, string name, T content)
24 | {
25 | var file = await folder.CreateFileAsync(GetFileName(name), CreationCollisionOption.ReplaceExisting);
26 | var fileContent = await Json.StringifyAsync(content);
27 |
28 | await FileIO.WriteTextAsync(file, fileContent);
29 | }
30 |
31 | public static async Task ReadAsync(this StorageFolder folder, string name)
32 | {
33 | if (!File.Exists(Path.Combine(folder.Path, GetFileName(name))))
34 | {
35 | return default(T);
36 | }
37 |
38 | var file = await folder.GetFileAsync($"{name}.json");
39 | var fileContent = await FileIO.ReadTextAsync(file);
40 |
41 | return await Json.ToObjectAsync(fileContent);
42 | }
43 |
44 | public static async Task SaveAsync(this ApplicationDataContainer settings, string key, T value)
45 | {
46 | settings.SaveString(key, await Json.StringifyAsync(value));
47 | }
48 |
49 | public static void SaveString(this ApplicationDataContainer settings, string key, string value)
50 | {
51 | settings.Values[key] = value;
52 | }
53 |
54 | public static async Task ReadAsync(this ApplicationDataContainer settings, string key)
55 | {
56 | object obj = null;
57 |
58 | if (settings.Values.TryGetValue(key, out obj))
59 | {
60 | return await Json.ToObjectAsync((string)obj);
61 | }
62 |
63 | return default(T);
64 | }
65 |
66 | public static async Task SaveFileAsync(this StorageFolder folder, byte[] content, string fileName, CreationCollisionOption options = CreationCollisionOption.ReplaceExisting)
67 | {
68 | if (content == null)
69 | {
70 | throw new ArgumentNullException(nameof(content));
71 | }
72 |
73 | if (string.IsNullOrEmpty(fileName))
74 | {
75 | throw new ArgumentException("ExceptionSettingsStorageExtensionsFileNameIsNullOrEmpty".GetLocalized(), nameof(fileName));
76 | }
77 |
78 | var storageFile = await folder.CreateFileAsync(fileName, options);
79 | await FileIO.WriteBytesAsync(storageFile, content);
80 | return storageFile;
81 | }
82 |
83 | public static async Task ReadFileAsync(this StorageFolder folder, string fileName)
84 | {
85 | var item = await folder.TryGetItemAsync(fileName).AsTask().ConfigureAwait(false);
86 |
87 | if ((item != null) && item.IsOfType(StorageItemTypes.File))
88 | {
89 | var storageFile = await folder.GetFileAsync(fileName);
90 | byte[] content = await storageFile.ReadBytesAsync();
91 | return content;
92 | }
93 |
94 | return null;
95 | }
96 |
97 | public static async Task ReadBytesAsync(this StorageFile file)
98 | {
99 | if (file != null)
100 | {
101 | using (IRandomAccessStream stream = await file.OpenReadAsync())
102 | {
103 | using (var reader = new DataReader(stream.GetInputStreamAt(0)))
104 | {
105 | await reader.LoadAsync((uint)stream.Size);
106 | var bytes = new byte[stream.Size];
107 | reader.ReadBytes(bytes);
108 | return bytes;
109 | }
110 | }
111 | }
112 |
113 | return null;
114 | }
115 |
116 | private static string GetFileName(string name)
117 | {
118 | return string.Concat(name, FileExtension);
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/Fluentpad/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
15 |
16 |
17 |
18 |
19 | Fluentpad
20 | ayush
21 | Assets\StoreLogo.png
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
36 |
42 |
43 |
44 |
45 |
46 |
47 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/Fluentpad/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("Fluentpad")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("Fluentpad")]
14 | [assembly: AssemblyCopyright("Copyright © 2020")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Version information for an assembly consists of the following four values:
19 | //
20 | // Major Version
21 | // Minor Version
22 | // Build Number
23 | // Revision
24 | //
25 | // You can specify all the values or you can default the Build and Revision Numbers
26 | // by using the '*' as shown below:
27 | // [assembly: AssemblyVersion("1.0.*")]
28 | [assembly: AssemblyVersion("1.0.0.0")]
29 | [assembly: AssemblyFileVersion("1.0.0.0")]
30 | [assembly: ComVisible(false)]
31 |
--------------------------------------------------------------------------------
/Fluentpad/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Fluentpad/Services/ActivationService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | using Fluentpad.Activation;
7 | using Fluentpad.Core.Helpers;
8 |
9 | using Windows.ApplicationModel.Activation;
10 | using Windows.System;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Input;
14 |
15 | namespace Fluentpad.Services
16 | {
17 | // For more information on understanding and extending activation flow see
18 | // https://github.com/Microsoft/WindowsTemplateStudio/blob/master/docs/UWP/activation.md
19 | internal class ActivationService
20 | {
21 | private readonly App _app;
22 | private readonly Type _defaultNavItem;
23 | private Lazy _shell;
24 |
25 | private object _lastActivationArgs;
26 |
27 | public static readonly KeyboardAccelerator AltLeftKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.Left, VirtualKeyModifiers.Menu);
28 |
29 | public static readonly KeyboardAccelerator BackKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.GoBack);
30 |
31 | public ActivationService(App app, Type defaultNavItem, Lazy shell = null)
32 | {
33 | _app = app;
34 | _shell = shell;
35 | _defaultNavItem = defaultNavItem;
36 | }
37 |
38 | public async Task ActivateAsync(object activationArgs)
39 | {
40 | if (IsInteractive(activationArgs))
41 | {
42 | // Initialize services that you need before app activation
43 | // take into account that the splash screen is shown while this code runs.
44 | await InitializeAsync();
45 |
46 | // Do not repeat app initialization when the Window already has content,
47 | // just ensure that the window is active
48 | if (Window.Current.Content == null)
49 | {
50 | // Create a Shell or Frame to act as the navigation context
51 | Window.Current.Content = _shell?.Value ?? new Frame();
52 | NavigationService.NavigationFailed += (sender, e) =>
53 | {
54 | throw e.Exception;
55 | };
56 | }
57 | }
58 |
59 | // Depending on activationArgs one of ActivationHandlers or DefaultActivationHandler
60 | // will navigate to the first page
61 | await HandleActivationAsync(activationArgs);
62 | _lastActivationArgs = activationArgs;
63 |
64 | if (IsInteractive(activationArgs))
65 | {
66 | // Ensure the current window is active
67 | Window.Current.Activate();
68 |
69 | // Tasks after activation
70 | await StartupAsync();
71 | }
72 | }
73 |
74 | private static KeyboardAccelerator BuildKeyboardAccelerator(VirtualKey key, VirtualKeyModifiers? modifiers = null)
75 | {
76 | var keyboardAccelerator = new KeyboardAccelerator() { Key = key };
77 | if (modifiers.HasValue)
78 | {
79 | keyboardAccelerator.Modifiers = modifiers.Value;
80 | }
81 |
82 | keyboardAccelerator.Invoked += OnKeyboardAcceleratorInvoked;
83 | return keyboardAccelerator;
84 | }
85 |
86 | private static void OnKeyboardAcceleratorInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
87 | {
88 | var result = NavigationService.GoBack();
89 | args.Handled = result;
90 | }
91 |
92 | private async Task InitializeAsync()
93 | {
94 | await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);
95 | }
96 |
97 | private async Task HandleActivationAsync(object activationArgs)
98 | {
99 | var activationHandler = GetActivationHandlers()
100 | .FirstOrDefault(h => h.CanHandle(activationArgs));
101 |
102 | if (activationHandler != null)
103 | {
104 | await activationHandler.HandleAsync(activationArgs);
105 | }
106 |
107 | if (IsInteractive(activationArgs))
108 | {
109 | var defaultHandler = new DefaultActivationHandler(_defaultNavItem);
110 | if (defaultHandler.CanHandle(activationArgs))
111 | {
112 | await defaultHandler.HandleAsync(activationArgs);
113 | }
114 | }
115 | }
116 |
117 | private async Task StartupAsync()
118 | {
119 | await ThemeSelectorService.SetRequestedThemeAsync();
120 | await FirstRunDisplayService.ShowIfAppropriateAsync();
121 | await WhatsNewDisplayService.ShowIfAppropriateAsync();
122 | }
123 |
124 | private IEnumerable GetActivationHandlers()
125 | {
126 | yield return Singleton.Instance;
127 | }
128 |
129 | private bool IsInteractive(object args)
130 | {
131 | return args is IActivatedEventArgs;
132 | }
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/Fluentpad/Services/FirstRunDisplayService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | using Fluentpad.Views;
5 |
6 | using Microsoft.Toolkit.Uwp.Helpers;
7 |
8 | using Windows.ApplicationModel.Core;
9 | using Windows.UI.Core;
10 |
11 | namespace Fluentpad.Services
12 | {
13 | public static class FirstRunDisplayService
14 | {
15 | private static bool shown = false;
16 |
17 | internal static async Task ShowIfAppropriateAsync()
18 | {
19 | await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
20 | CoreDispatcherPriority.Normal, async () =>
21 | {
22 | if (SystemInformation.IsFirstRun && !shown)
23 | {
24 | shown = true;
25 | var dialog = new FirstRunDialog();
26 | await dialog.ShowAsync();
27 | }
28 | });
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Fluentpad/Services/NavigationService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Windows.UI.Xaml;
4 | using Windows.UI.Xaml.Controls;
5 | using Windows.UI.Xaml.Media.Animation;
6 | using Windows.UI.Xaml.Navigation;
7 |
8 | namespace Fluentpad.Services
9 | {
10 | public static class NavigationService
11 | {
12 | public static event NavigatedEventHandler Navigated;
13 |
14 | public static event NavigationFailedEventHandler NavigationFailed;
15 |
16 | private static Frame _frame;
17 | private static object _lastParamUsed;
18 |
19 | public static Frame Frame
20 | {
21 | get
22 | {
23 | if (_frame == null)
24 | {
25 | _frame = Window.Current.Content as Frame;
26 | RegisterFrameEvents();
27 | }
28 |
29 | return _frame;
30 | }
31 |
32 | set
33 | {
34 | UnregisterFrameEvents();
35 | _frame = value;
36 | RegisterFrameEvents();
37 | }
38 | }
39 |
40 | public static bool CanGoBack => Frame.CanGoBack;
41 |
42 | public static bool CanGoForward => Frame.CanGoForward;
43 |
44 | public static bool GoBack()
45 | {
46 | if (CanGoBack)
47 | {
48 | Frame.GoBack();
49 | return true;
50 | }
51 |
52 | return false;
53 | }
54 |
55 | public static void GoForward() => Frame.GoForward();
56 |
57 | public static bool Navigate(Type pageType, object parameter = null, NavigationTransitionInfo infoOverride = null)
58 | {
59 | // Don't open the same page multiple times
60 | if (Frame.Content?.GetType() != pageType || (parameter != null && !parameter.Equals(_lastParamUsed)))
61 | {
62 | var navigationResult = Frame.Navigate(pageType, parameter, infoOverride);
63 | if (navigationResult)
64 | {
65 | _lastParamUsed = parameter;
66 | }
67 |
68 | return navigationResult;
69 | }
70 | else
71 | {
72 | return false;
73 | }
74 | }
75 |
76 | public static bool Navigate(object parameter = null, NavigationTransitionInfo infoOverride = null)
77 | where T : Page
78 | => Navigate(typeof(T), parameter, infoOverride);
79 |
80 | private static void RegisterFrameEvents()
81 | {
82 | if (_frame != null)
83 | {
84 | _frame.Navigated += Frame_Navigated;
85 | _frame.NavigationFailed += Frame_NavigationFailed;
86 | }
87 | }
88 |
89 | private static void UnregisterFrameEvents()
90 | {
91 | if (_frame != null)
92 | {
93 | _frame.Navigated -= Frame_Navigated;
94 | _frame.NavigationFailed -= Frame_NavigationFailed;
95 | }
96 | }
97 |
98 | private static void Frame_NavigationFailed(object sender, NavigationFailedEventArgs e) => NavigationFailed?.Invoke(sender, e);
99 |
100 | private static void Frame_Navigated(object sender, NavigationEventArgs e) => Navigated?.Invoke(sender, e);
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/Fluentpad/Services/ThemeSelectorService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | using Fluentpad.Helpers;
5 |
6 | using Windows.ApplicationModel.Core;
7 | using Windows.Storage;
8 | using Windows.UI.Core;
9 | using Windows.UI.Xaml;
10 |
11 | namespace Fluentpad.Services
12 | {
13 | public static class ThemeSelectorService
14 | {
15 | private const string SettingsKey = "AppBackgroundRequestedTheme";
16 |
17 | public static ElementTheme Theme { get; set; } = ElementTheme.Default;
18 |
19 | public static async Task InitializeAsync()
20 | {
21 | Theme = await LoadThemeFromSettingsAsync();
22 | }
23 |
24 | public static async Task SetThemeAsync(ElementTheme theme)
25 | {
26 | Theme = theme;
27 |
28 | await SetRequestedThemeAsync();
29 | await SaveThemeInSettingsAsync(Theme);
30 | }
31 |
32 | public static async Task SetRequestedThemeAsync()
33 | {
34 | foreach (var view in CoreApplication.Views)
35 | {
36 | await view.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
37 | {
38 | if (Window.Current.Content is FrameworkElement frameworkElement)
39 | {
40 | frameworkElement.RequestedTheme = Theme;
41 | }
42 | });
43 | }
44 | }
45 |
46 | private static async Task LoadThemeFromSettingsAsync()
47 | {
48 | ElementTheme cacheTheme = ElementTheme.Default;
49 | string themeName = await ApplicationData.Current.LocalSettings.ReadAsync(SettingsKey);
50 |
51 | if (!string.IsNullOrEmpty(themeName))
52 | {
53 | Enum.TryParse(themeName, out cacheTheme);
54 | }
55 |
56 | return cacheTheme;
57 | }
58 |
59 | private static async Task SaveThemeInSettingsAsync(ElementTheme theme)
60 | {
61 | await ApplicationData.Current.LocalSettings.SaveAsync(SettingsKey, theme.ToString());
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Fluentpad/Services/WhatsNewDisplayService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | using Fluentpad.Views;
5 |
6 | using Microsoft.Toolkit.Uwp.Helpers;
7 |
8 | using Windows.ApplicationModel.Core;
9 | using Windows.UI.Core;
10 |
11 | namespace Fluentpad.Services
12 | {
13 | // For instructions on testing this service see https://github.com/Microsoft/WindowsTemplateStudio/blob/master/docs/UWP/features/whats-new-prompt.md
14 | public static class WhatsNewDisplayService
15 | {
16 | private static bool shown = false;
17 |
18 | internal static async Task ShowIfAppropriateAsync()
19 | {
20 | await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
21 | CoreDispatcherPriority.Normal, async () =>
22 | {
23 | if (SystemInformation.IsAppUpdated && !shown)
24 | {
25 | shown = true;
26 | var dialog = new WhatsNewDialog();
27 | await dialog.ShowAsync();
28 | }
29 | });
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Fluentpad/Strings/en-us/Resources.resw:
--------------------------------------------------------------------------------
1 |
2 |
3 |
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 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Fluentpad
122 | Application display name
123 |
124 |
125 | Fluentpad
126 | Application description
127 |
128 |
129 | Tabs
130 | Page title for TabsPage
131 |
132 |
133 | PlantxtView
134 | Page title for PlantxtViewPage
135 |
136 |
137 | MarkdownView
138 | Page title for MarkdownViewPage
139 |
140 |
141 | RichView
142 | Page title for RichViewPage
143 |
144 |
145 | File name is null or empty. Specify a valid file name
146 | File name is null or empty to save file in settings storage extensions
147 |
148 |
149 | Choose Theme
150 | Choose theme text for Settings
151 |
152 |
153 | Dark
154 | Dark theme text for Settings
155 |
156 |
157 | Windows default
158 | Windows default theme text for Settings
159 |
160 |
161 | Light
162 | Light theme text for Settings
163 |
164 |
165 | About this application
166 | About this application title for Settings
167 |
168 |
169 | Settings page placeholder text. Your app description goes here.
170 | About this application description for Settings
171 |
172 |
173 | Privacy Statement
174 | Privacy Statement link content for Settings
175 |
176 |
177 | https://YourPrivacyUrlGoesHere/
178 | Here is your Privacy Statement url for Settings
179 |
180 |
181 | Personalization
182 | Personalization text for Settings
183 |
184 |
185 | value must be an Enum!
186 | Value must be an Enum in enum to boolean converter
187 |
188 |
189 | parameter must be an Enum name!
190 | Parameter must be an Enum name in enum to boolean converter
191 |
192 |
193 | Settings
194 | Page title for SettingsPage
195 |
196 |
197 | Replace the content of this dialog with whatever content is appropriate to your app.
198 | You might want to explain key features or functionality.
199 | Don't feel restricted to just text. You can also include images and animations if you wish too.
200 |
201 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna.
202 |
203 | Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus.
204 |
205 | Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci.
206 |
207 | Suspendisse dui purus, scelerisque at, vulputate vitae, pretium mattis, nunc. Mauris eget neque at sem venenatis eleifend. Ut nonummy.
208 | First use prompt message body
209 |
210 |
211 | Welcome
212 | First use prompt message title
213 |
214 |
215 | Ok
216 | First use prompt message primary button text
217 |
218 |
219 | Replace the content of this dialog with whatever content is appropriate to your app.
220 | You might want to consider lists of bug fixes and new features.
221 | Don't feel restricted to just text. You can also include images and animations if you wish too.
222 |
223 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna.
224 | Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus.
225 | Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci.
226 | Suspendisse dui purus, scelerisque at, vulputate vitae, pretium mattis, nunc. Mauris eget neque at sem venenatis eleifend. Ut nonummy.
227 | What's new prompt message body
228 |
229 |
230 | What's new in this version
231 | What's new prompt message title
232 |
233 |
234 | Ok
235 | What's new prompt message primary button text
236 |
237 |
238 | Feedback
239 | Displayed as the link to launching the Feedback Hub.
240 |
241 |
242 |
--------------------------------------------------------------------------------
/Fluentpad/Styles/Page.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Fluentpad/Styles/PlainTextBoxxaml.xaml:
--------------------------------------------------------------------------------
1 |
5 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | Visible
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/Fluentpad/Styles/TextBlock.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
13 |
14 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Fluentpad/Styles/_Colors.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Fluentpad/Styles/_FontSizes.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 | 24
6 | 16
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Fluentpad/Styles/_Thickness.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | 0,36,0,0
7 |
8 |
9 | 24,0,0,0
10 | 24,0,24,0
11 | 24,24,24,24
12 | 0,24,0,0
13 | 0,24,0,24
14 | 0,0,24,0
15 | 0,0,0,24
16 |
17 |
18 | 12, 0, 0, 0
19 | 12, 12, 0, 0
20 | 12, 0, 12, 0
21 | 12, 12, 12, 12
22 | 0, 12, 0, 0
23 | 0, 12, 12, 12
24 | 0, 12, 0, 12
25 | 0, 0, 12, 0
26 |
27 |
28 | 8, 0, 0, 0
29 | 8, 8, 8, 8
30 | 0, 8, 0, 0
31 |
32 |
33 | 0, 4, 0, 0
34 | 0, 4, 4, 4
35 |
--------------------------------------------------------------------------------
/Fluentpad/Views/CmdLineActivationSamplePage.xaml:
--------------------------------------------------------------------------------
1 |
9 |
12 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Fluentpad/Views/CmdLineActivationSamplePage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Windows.UI.Xaml.Controls;
4 | using Windows.UI.Xaml.Navigation;
5 |
6 | namespace Fluentpad.Views
7 | {
8 | // TODO WTS: Remove this sample page when/if it's not needed.
9 | // This page is an sample of how to launch a specific page in response to launching from the command line and passing arguments.
10 | // It is expected that you will delete this page once you have changed the handling of command line launch to meet
11 | // your needs and redirected to another of your pages.
12 | public sealed partial class CmdLineActivationSamplePage : Page
13 | {
14 | public CmdLineActivationSamplePage()
15 | {
16 | InitializeComponent();
17 | }
18 |
19 | protected override void OnNavigatedTo(NavigationEventArgs e)
20 | {
21 | base.OnNavigatedTo(e);
22 |
23 | PassedArguments.Text = e.Parameter?.ToString();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Fluentpad/Views/FirstRunDialog.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Fluentpad/Views/FirstRunDialog.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Windows.UI.Xaml;
4 | using Windows.UI.Xaml.Controls;
5 |
6 | namespace Fluentpad.Views
7 | {
8 | public sealed partial class FirstRunDialog : ContentDialog
9 | {
10 | public FirstRunDialog()
11 | {
12 | // TODO WTS: Update the contents of this dialog with any important information you want to show when the app is used for the first time.
13 | RequestedTheme = (Window.Current.Content as FrameworkElement).RequestedTheme;
14 | InitializeComponent();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Fluentpad/Views/MarkdownViewPage.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
19 |
22 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Fluentpad/Views/MarkdownViewPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Runtime.CompilerServices;
4 |
5 | using Windows.UI.Xaml.Controls;
6 |
7 | namespace Fluentpad.Views
8 | {
9 | public sealed partial class MarkdownViewPage : Page, INotifyPropertyChanged
10 | {
11 | public MarkdownViewPage()
12 | {
13 | InitializeComponent();
14 | }
15 |
16 | public event PropertyChangedEventHandler PropertyChanged;
17 |
18 | private void Set(ref T storage, T value, [CallerMemberName]string propertyName = null)
19 | {
20 | if (Equals(storage, value))
21 | {
22 | return;
23 | }
24 |
25 | storage = value;
26 | OnPropertyChanged(propertyName);
27 | }
28 |
29 | private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Fluentpad/Views/PlantxtViewPage.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 | White
14 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 | Collapsed
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 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
241 |
242 |
243 |
244 |
246 |
247 |
248 |
249 |
250 | coming soon
251 |
252 |
253 |
254 |
255 |
256 |
--------------------------------------------------------------------------------
/Fluentpad/Views/PlantxtViewPage.xaml.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 Windows.ApplicationModel.DataTransfer;
8 | using Windows.Storage;
9 | using Windows.System;
10 | using Windows.UI;
11 | using Windows.UI.Core;
12 | using Windows.UI.Text;
13 | using Windows.UI.ViewManagement.Core;
14 | using Windows.UI.Xaml;
15 | using Windows.UI.Xaml.Controls;
16 | using Windows.UI.Xaml.Controls.Primitives;
17 | using Windows.UI.Xaml.Input;
18 | using Windows.UI.Xaml.Media;
19 |
20 | namespace Fluentpad.Views
21 | {
22 | public sealed partial class PlantxtViewPage : Page, INotifyPropertyChanged
23 | {
24 | public PlantxtViewPage()
25 | {
26 | InitializeComponent();
27 | var fonts = Microsoft.Graphics.Canvas.Text.CanvasTextFormat.GetSystemFontFamilies();
28 |
29 | // Put the individual fonts in the list
30 | foreach (string font in fonts)
31 | {
32 | Fonts.Add(new Tuple(font, new FontFamily(font)));
33 | }
34 | }
35 | public List> Fonts { get; } = new List>()
36 | {
37 | new Tuple("Arial", new FontFamily("Arial")),
38 | new Tuple("Comic Sans MS", new FontFamily("Comic Sans MS")),
39 | new Tuple("Courier New", new FontFamily("Courier New")),
40 | new Tuple("Segoe UI", new FontFamily("Segoe UI")),
41 | new Tuple("Times New Roman", new FontFamily("Times New Roman"))
42 | };
43 | public event PropertyChangedEventHandler PropertyChanged;
44 |
45 | private void Set(ref T storage, T value, [CallerMemberName]string propertyName = null)
46 | {
47 | if (Equals(storage, value))
48 | {
49 | return;
50 | }
51 |
52 | storage = value;
53 | OnPropertyChanged(propertyName);
54 | }
55 |
56 | private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
57 |
58 | ///
59 | /// Temporary store the copy of text when it loaded,
60 | /// if it didn't match the textbox=it changed
61 | ///
62 |
63 |
64 | private bool IsCttrlPressed()
65 | {
66 | var state = CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Control);
67 | return (state & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
68 | }
69 |
70 | public List FontSizes { get; } = new List()
71 | {
72 | 8,
73 | 9,
74 | 10,
75 | 11,
76 | 12,
77 | 14,
78 | 16,
79 | 18,
80 | 20,
81 | 24,
82 | 28,
83 | 36,
84 | 48,
85 | 72
86 | };
87 |
88 | private void PlainText_DragOver(object sender, DragEventArgs e)
89 | {
90 | e.AcceptedOperation = DataPackageOperation.Copy;
91 | }
92 | private void Combo3_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
93 | {
94 | Combo3.SelectedIndex = 9;
95 |
96 |
97 | Combo3.TextSubmitted += Combo3_TextSubmitted;
98 |
99 | }
100 |
101 | private void Combo2_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
102 | {
103 | Combo2.SelectedIndex = 2;
104 | }
105 | private void Combo3_TextSubmitted(ComboBox sender, ComboBoxTextSubmittedEventArgs args)
106 | {
107 | bool isDouble = double.TryParse(sender.Text, out double newValue);
108 |
109 | // Set the selected item if:
110 | // - The value successfully parsed to double AND
111 | // - The value is in the list of sizes OR is a custom value between 8 and 100
112 | if (isDouble && (FontSizes.Contains(newValue) || (newValue < 100 && newValue > 8)))
113 | {
114 | // Update the SelectedItem to the new value.
115 | sender.SelectedItem = newValue;
116 | }
117 | else
118 | {
119 | // If the item is invalid, reject it and revert the text.
120 | sender.Text = sender.SelectedValue.ToString();
121 |
122 | var dialog = new ContentDialog
123 | {
124 | Content = "The font size must be a number between 8 and 100.",
125 | CloseButtonText = "Close",
126 | DefaultButton = ContentDialogButton.Close
127 | };
128 | var task = dialog.ShowAsync();
129 | }
130 |
131 | // Mark the event as handled so the framework doesn’t update the selected item automatically.
132 | args.Handled = true;
133 | }
134 |
135 | private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
136 | {
137 | PlainText.Height = Window.Current.Bounds.Height - 80;
138 | PlainText.Width = Window.Current.Bounds.Width;
139 | }
140 |
141 | private void AppBarButton_Click(object sender, RoutedEventArgs e)
142 | {
143 | CoreInputView.GetForCurrentView().TryShow(CoreInputViewKind.Emoji);
144 | }
145 |
146 |
147 | private List LineIndices = new List();
148 | private void GetPosition(int position)
149 | {
150 | var target = position;
151 |
152 | var lines = LineIndices.Where(i => i < target).ToList();
153 |
154 | if (lines.Count != 0)
155 | {
156 | var lastMarker = lines.Max(i => i);
157 |
158 | CurrentPos.Text = "Column: " + (position - lastMarker).ToString();
159 | LinePos.Text = "Line: " + (LineIndices.IndexOf(lastMarker) + 2).ToString();
160 | }
161 | else
162 | {
163 | LinePos.Text = "Line: 1";
164 | CurrentPos.Text = "Column: " + (position + 1).ToString();
165 | }
166 | }
167 |
168 |
169 | private void PlainText_SelectionChanged(object sender, RoutedEventArgs e)
170 | {
171 | GetPosition(PlainText.SelectionStart + PlainText.SelectionLength);
172 | }
173 | private void TextBox_OnBeforeTextChanging(TextBox sender, TextBoxBeforeTextChangingEventArgs args)
174 | {
175 | PlainText.SelectionChanged -= PlainText_SelectionChanged;
176 | }
177 | private void TextBox_OnTextChanged(object sender, TextChangedEventArgs e)
178 | {
179 | PlainText.SelectionChanged -= PlainText_SelectionChanged;
180 | Reindex();
181 |
182 | PlainText_SelectionChanged(sender, e);
183 |
184 | PlainText.SelectionChanged += PlainText_SelectionChanged;
185 |
186 | }
187 | private void ZoomSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
188 | {
189 | if (ScrollZoom != null)
190 | {
191 | ScrollZoom.ChangeView(null, null, (float)e.NewValue);
192 | }
193 | }
194 | public void Reindex()
195 | {
196 |
197 |
198 | var index = -1;
199 | var text = PlainText.Text.Replace(Environment.NewLine, "\r");
200 | while ((index = text.IndexOf('\r', index + 1)) > -1)
201 | {
202 | index++;
203 | LineIndices.Add(index);
204 |
205 | if (index + 1 >= text.Length) break;
206 | }
207 |
208 | GetPosition(PlainText.SelectionStart + PlainText.SelectionLength);
209 | }
210 |
211 | private void ScrollZoom_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
212 | {
213 | ZoomSlider.Value = ScrollZoom.ZoomFactor;
214 | }
215 |
216 | private void ScrollZoom_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
217 | {
218 | ZoomSlider.Value = ScrollZoom.ZoomFactor;
219 | }
220 |
221 | private void AppBarButton_Click_1(object sender, RoutedEventArgs e)
222 | {
223 | ToggleThemeTeachingTip1.IsOpen = true;
224 | }
225 | private async void OpenButton_Click(object sender, RoutedEventArgs e)
226 | {
227 | // Open a text file.
228 | Windows.Storage.Pickers.FileOpenPicker open =
229 | new Windows.Storage.Pickers.FileOpenPicker();
230 | open.SuggestedStartLocation =
231 | Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary;
232 | open.FileTypeFilter.Add("*");
233 |
234 | Windows.Storage.StorageFile file = await open.PickSingleFileAsync();
235 |
236 | if (file != null)
237 | {
238 |
239 | //PlainText.Text = await FileIO.ReadTextAsync(file);
240 | var provider = new StorageFileDataProvider();
241 | var bytes = await provider.LoadDataAsync(file);
242 | var reader = new EncodingReader();
243 | reader.AddBytes(bytes);
244 |
245 | byte[] bom = null;
246 |
247 | try
248 | {
249 | ByteOrderMarks.ToList().ForEach(pair =>
250 | {
251 | var (key, value) = pair;
252 |
253 | if (!bytes.AsSpan(0, value.Length).StartsWith(value.AsSpan(0, value.Length))) return;
254 |
255 | var encoding = key switch
256 | {
257 | ByteOrderMark.Utf8 => Encoding.UTF8,
258 | ByteOrderMark.Utf16Be => Encoding.BigEndianUnicode,
259 | ByteOrderMark.Utf16Le => Encoding.Unicode,
260 | ByteOrderMark.Utf32Be => Encoding.UTF32,
261 | ByteOrderMark.Utf32Le => Encoding.UTF32,
262 | ByteOrderMark.Utf7A => Encoding.UTF7,
263 | ByteOrderMark.Utf7B => Encoding.UTF7,
264 | ByteOrderMark.Utf7C => Encoding.UTF7,
265 | ByteOrderMark.Utf7D => Encoding.UTF7,
266 | ByteOrderMark.Utf7E => Encoding.UTF7,
267 | _ => Encoding.ASCII
268 | };
269 |
270 | documentViewModel.CurrentEncoding = encoding;
271 |
272 | reader = new EncodingReader();
273 | reader.AddBytes(bytes.AsSpan().Slice(value.Length).ToArray());
274 | bom = value;
275 | });
276 | }
277 | catch (Exception ex)
278 | {
279 | Logger.LogError(new EventId(), $"Error loading {file.Name}.", ex);
280 | Settings.Status(ex.Message, TimeSpan.FromSeconds(60), Verbosity.Error);
281 | }
282 |
283 | var text = reader.Read(documentViewModel.CurrentEncoding);
284 | }
285 | }
286 | }
287 |
288 | }
289 |
290 |
--------------------------------------------------------------------------------
/Fluentpad/Views/RichViewPage.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
19 |
22 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Fluentpad/Views/RichViewPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Runtime.CompilerServices;
4 |
5 | using Windows.UI.Xaml.Controls;
6 |
7 | namespace Fluentpad.Views
8 | {
9 | public sealed partial class RichViewPage : Page, INotifyPropertyChanged
10 | {
11 | public RichViewPage()
12 | {
13 | InitializeComponent();
14 | }
15 |
16 | public event PropertyChangedEventHandler PropertyChanged;
17 |
18 | private void Set(ref T storage, T value, [CallerMemberName]string propertyName = null)
19 | {
20 | if (Equals(storage, value))
21 | {
22 | return;
23 | }
24 |
25 | storage = value;
26 | OnPropertyChanged(propertyName);
27 | }
28 |
29 | private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Fluentpad/Views/SettingsPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
24 |
25 |
28 |
29 |
30 |
31 |
32 |
33 |
39 |
40 | Light
41 |
42 |
43 |
49 |
50 | Dark
51 |
52 |
53 |
59 |
60 | Default
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
74 |
75 |
76 |
77 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/Fluentpad/Views/SettingsPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Runtime.CompilerServices;
4 | using System.Threading.Tasks;
5 |
6 | using Fluentpad.Helpers;
7 | using Fluentpad.Services;
8 |
9 | using Windows.ApplicationModel;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Navigation;
13 |
14 | namespace Fluentpad.Views
15 | {
16 | // TODO WTS: Add other settings as necessary. For help see https://github.com/Microsoft/WindowsTemplateStudio/blob/master/docs/UWP/pages/settings-codebehind.md
17 | // TODO WTS: Change the URL for your privacy policy in the Resource File, currently set to https://YourPrivacyUrlGoesHere
18 | public sealed partial class SettingsPage : Page, INotifyPropertyChanged
19 | {
20 | private ElementTheme _elementTheme = ThemeSelectorService.Theme;
21 |
22 | public ElementTheme ElementTheme
23 | {
24 | get { return _elementTheme; }
25 |
26 | set { Set(ref _elementTheme, value); }
27 | }
28 |
29 | private string _versionDescription;
30 |
31 | public string VersionDescription
32 | {
33 | get { return _versionDescription; }
34 |
35 | set { Set(ref _versionDescription, value); }
36 | }
37 |
38 | public SettingsPage()
39 | {
40 | InitializeComponent();
41 | }
42 |
43 | protected override async void OnNavigatedTo(NavigationEventArgs e)
44 | {
45 | await InitializeAsync();
46 | }
47 |
48 | private async Task InitializeAsync()
49 | {
50 | VersionDescription = GetVersionDescription();
51 | await Task.CompletedTask;
52 |
53 | if (Microsoft.Services.Store.Engagement.StoreServicesFeedbackLauncher.IsSupported())
54 | {
55 | FeedbackLink.Visibility = Visibility.Visible;
56 | }
57 | }
58 |
59 | private string GetVersionDescription()
60 | {
61 | var appName = "AppDisplayName".GetLocalized();
62 | var package = Package.Current;
63 | var packageId = package.Id;
64 | var version = packageId.Version;
65 |
66 | return $"{appName} - {version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
67 | }
68 |
69 | private async void ThemeChanged_CheckedAsync(object sender, RoutedEventArgs e)
70 | {
71 | var param = (sender as RadioButton)?.CommandParameter;
72 |
73 | if (param != null)
74 | {
75 | await ThemeSelectorService.SetThemeAsync((ElementTheme)param);
76 | }
77 | }
78 |
79 | public event PropertyChangedEventHandler PropertyChanged;
80 |
81 | private void Set(ref T storage, T value, [CallerMemberName]string propertyName = null)
82 | {
83 | if (Equals(storage, value))
84 | {
85 | return;
86 | }
87 |
88 | storage = value;
89 | OnPropertyChanged(propertyName);
90 | }
91 |
92 | private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
93 |
94 | private async void FeedbackLink_Click(object sender, RoutedEventArgs e)
95 | {
96 | // This launcher is part of the Store Services SDK https://docs.microsoft.com/windows/uwp/monetize/microsoft-store-services-sdk
97 | var launcher = Microsoft.Services.Store.Engagement.StoreServicesFeedbackLauncher.GetDefault();
98 | await launcher.LaunchAsync();
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/Fluentpad/Views/TabsPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Fluentpad/Views/TabsPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.UI.Xaml.Controls;
2 | using System;
3 | using System.ComponentModel;
4 | using System.Runtime.CompilerServices;
5 |
6 | using Windows.UI.Xaml.Controls;
7 |
8 | namespace Fluentpad.Views
9 | {
10 | public sealed partial class TabsPage : Page, INotifyPropertyChanged
11 | {
12 | public TabsPage()
13 | {
14 | InitializeComponent();
15 | var newTab = new TabViewItem();
16 | newTab.IconSource = new Microsoft.UI.Xaml.Controls.SymbolIconSource() { Symbol = Symbol.Document };
17 | newTab.Header = "New Document";
18 |
19 | // The Content of a TabViewItem is often a frame which hosts a page.
20 | Frame frame = new Frame();
21 | newTab.Content = frame;
22 | frame.Navigate(typeof(PlantxtViewPage));
23 |
24 | Tabs.TabItems.Add(newTab);
25 | }
26 | private void Tabs_AddTabButtonClick(TabView sender, object e)
27 | {
28 | var newTab = new TabViewItem();
29 | newTab.IconSource = new Microsoft.UI.Xaml.Controls.SymbolIconSource() { Symbol = Symbol.Document };
30 | newTab.Header = "New Document";
31 |
32 | // The Content of a TabViewItem is often a frame which hosts a page.
33 | Frame frame = new Frame();
34 | newTab.Content = frame;
35 | frame.Navigate(typeof(PlantxtViewPage));
36 |
37 | sender.TabItems.Add(newTab);
38 | }
39 |
40 | // Remove the requested tab from the TabView
41 | private void Tabs_TabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args)
42 | {
43 | sender.TabItems.Remove(args.Tab);
44 | }
45 | public event PropertyChangedEventHandler PropertyChanged;
46 |
47 | private void Set(ref T storage, T value, [CallerMemberName]string propertyName = null)
48 | {
49 | if (Equals(storage, value))
50 | {
51 | return;
52 | }
53 |
54 | storage = value;
55 | OnPropertyChanged(propertyName);
56 | }
57 |
58 | private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/Fluentpad/Views/WhatsNewDialog.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Fluentpad/Views/WhatsNewDialog.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Windows.UI.Xaml;
4 | using Windows.UI.Xaml.Controls;
5 |
6 | namespace Fluentpad.Views
7 | {
8 | public sealed partial class WhatsNewDialog : ContentDialog
9 | {
10 | public WhatsNewDialog()
11 | {
12 | // TODO WTS: Update the contents of this dialog every time you release a new version of the app
13 | RequestedTheme = (Window.Current.Content as FrameworkElement).RequestedTheme;
14 | InitializeComponent();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2 | Version 3, January 2021
3 |
4 | Copyright (C) 2004 FireCubeStudios
5 |
6 | Everyone is permitted to copy and distribute verbatim or modified
7 | copies of this license document, and changing it is allowed as long
8 | as the name is changed.
9 |
10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12 |
13 | 0. You just DO WHAT THE FUCK YOU WANT TO.
14 |
--------------------------------------------------------------------------------