├── .gitignore
├── LICENSE
├── README.md
├── appveyor.yml
└── source
├── BrowseHistoryDemo.sln
├── BrowseHistoryDemo
├── App.config
├── App.xaml
├── App.xaml.cs
├── BrowseHistoryDemo.csproj
├── MainWindow.xaml
├── MainWindow.xaml.cs
└── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── BrowseHistoryThemesDemo
├── App.config
├── App.xaml
├── App.xaml.cs
├── BindToMLib
│ ├── HistoryControlLib
│ │ └── DarkLightBrushs.xaml
│ └── MWindowLib
│ │ ├── DarkBrushs.xaml
│ │ └── LightBrushs.xaml
├── BrowseHistoryThemesDemo.csproj
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Models
│ ├── AppCore.cs
│ └── SettingDefaults.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── ServiceInjector.cs
├── ViewModels
│ ├── AppLifeCycleViewModel.cs
│ ├── AppViewModel.cs
│ ├── ThemeDefinitionViewModel.cs
│ └── ThemeViewModel.cs
└── packages.config
├── BrowserHistoryDemoLib
├── BrowserHistoryDemoLib.csproj
├── Properties
│ └── AssemblyInfo.cs
├── ViewModels
│ ├── AppViewModel.cs
│ ├── Base
│ │ ├── BaseViewModel.cs
│ │ └── RelayCommand.cs
│ └── LocationItem.cs
└── Views
│ ├── BrowseHistoryDebugView.xaml
│ ├── BrowseHistoryDebugView.xaml.cs
│ ├── BrowseHistoryDemoControl.xaml
│ └── BrowseHistoryDemoControl.xaml.cs
├── CleanAll.bat
├── Components
├── ServiceLocator
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ServiceContainer.cs
│ └── ServiceLocator.csproj
└── Settings
│ ├── Settings
│ ├── Interfaces
│ │ ├── IOptions.cs
│ │ ├── IOptionsPanel.cs
│ │ ├── IProfile.cs
│ │ ├── ISettingsManager.cs
│ │ └── IViewPosSizeModel.cs
│ ├── Internal
│ │ └── SettingsManagerImpl.cs
│ ├── ProgramSettings
│ │ ├── LanguageCollection.cs
│ │ └── OptionsPanel.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── SerializableDictionary.cs
│ ├── Settings.csproj
│ ├── SettingsManager.cs
│ ├── UserProfile
│ │ ├── IViewSize.cs
│ │ ├── LocalizabilityAttribute.cs
│ │ ├── Profile.cs
│ │ ├── ViewPosSizeModel.cs
│ │ └── ViewSize.cs
│ └── packages.config
│ └── SettingsModel
│ ├── ExtensionMethods
│ └── SecureStringExtensionMethod.cs
│ ├── Interfaces
│ ├── IEngine.cs
│ ├── IOptionGroup.cs
│ └── IOptionsSchema.cs
│ ├── Models
│ ├── Engine.cs
│ ├── Factory.cs
│ ├── FileReference.cs
│ ├── OptionGroup.cs
│ ├── OptionsSchema.cs
│ └── XML
│ │ ├── Converters
│ │ ├── AlternativeDataTypeHandler.cs
│ │ ├── IAlternativeDataTypeHandler.cs
│ │ └── SecureStringHandler.cs
│ │ └── XMLLayer.cs
│ ├── Overview.cd
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── SettingsModel.csproj
│ └── packages.config
└── HistoryControlLib
├── AssemblyInfo.cs
├── Behaviors
└── SelectionChangedCommand.cs
├── Controls
├── LocationsDropDown.cs
└── LocationsDropDown.xaml
├── Factory.cs
├── HistoryControlLib.csproj
├── Interfaces
└── IBrowseHistory.cs
├── Styles
└── HistoryButtonStyle.xaml
├── Themes
├── DarkBrushs.xaml
├── DarkTheme.xaml
├── Generic.xaml
├── LightBrushs.xaml
├── LightTheme.xaml
└── ResourceKeys.cs
└── ViewModels
├── Base
└── BaseViewModel.cs
└── BrowseHistory.cs
/.gitignore:
--------------------------------------------------------------------------------
1 | source/packages/
2 | packages/
3 | 00_Release/
4 | 01_Nuget/
5 |
6 | ## Ignore Visual Studio temporary files, build results, and
7 | ## files generated by popular Visual Studio add-ons.
8 | ##
9 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
10 |
11 | # User-specific files
12 | *.suo
13 | *.user
14 | *.userosscache
15 | *.sln.docstates
16 |
17 | # User-specific files (MonoDevelop/Xamarin Studio)
18 | *.userprefs
19 |
20 | # Build results
21 | [Dd]ebug/
22 | [Dd]ebugPublic/
23 | [Rr]elease/
24 | [Rr]eleases/
25 | x64/
26 | x86/
27 | bld/
28 | [Bb]in/
29 | [Oo]bj/
30 | [Ll]og/
31 |
32 | # Visual Studio 2015 cache/options directory
33 | source/.vs/
34 | # Uncomment if you have tasks that create the project's static files in wwwroot
35 | #wwwroot/
36 |
37 | # MSTest test Results
38 | [Tt]est[Rr]esult*/
39 | [Bb]uild[Ll]og.*
40 |
41 | # NUNIT
42 | *.VisualState.xml
43 | TestResult.xml
44 |
45 | # Build Results of an ATL Project
46 | [Dd]ebugPS/
47 | [Rr]eleasePS/
48 | dlldata.c
49 |
50 | # .NET Core
51 | project.lock.json
52 | project.fragment.lock.json
53 | artifacts/
54 | **/Properties/launchSettings.json
55 |
56 | *_i.c
57 | *_p.c
58 | *_i.h
59 | *.ilk
60 | *.meta
61 | *.obj
62 | *.pch
63 | *.pdb
64 | *.pgc
65 | *.pgd
66 | *.rsp
67 | *.sbr
68 | *.tlb
69 | *.tli
70 | *.tlh
71 | *.tmp
72 | *.tmp_proj
73 | *.log
74 | *.vspscc
75 | *.vssscc
76 | .builds
77 | *.pidb
78 | *.svclog
79 | *.scc
80 |
81 | # Chutzpah Test files
82 | _Chutzpah*
83 |
84 | # Visual C++ cache files
85 | ipch/
86 | *.aps
87 | *.ncb
88 | *.opendb
89 | *.opensdf
90 | *.sdf
91 | *.cachefile
92 | *.VC.db
93 | *.VC.VC.opendb
94 |
95 | # Visual Studio profiler
96 | *.psess
97 | *.vsp
98 | *.vspx
99 | *.sap
100 |
101 | # TFS 2012 Local Workspace
102 | $tf/
103 |
104 | # Guidance Automation Toolkit
105 | *.gpState
106 |
107 | # ReSharper is a .NET coding add-in
108 | _ReSharper*/
109 | *.[Rr]e[Ss]harper
110 | *.DotSettings.user
111 |
112 | # JustCode is a .NET coding add-in
113 | .JustCode
114 |
115 | # TeamCity is a build add-in
116 | _TeamCity*
117 |
118 | # DotCover is a Code Coverage Tool
119 | *.dotCover
120 |
121 | # Visual Studio code coverage results
122 | *.coverage
123 | *.coveragexml
124 |
125 | # NCrunch
126 | _NCrunch_*
127 | .*crunch*.local.xml
128 | nCrunchTemp_*
129 |
130 | # MightyMoose
131 | *.mm.*
132 | AutoTest.Net/
133 |
134 | # Web workbench (sass)
135 | .sass-cache/
136 |
137 | # Installshield output folder
138 | [Ee]xpress/
139 |
140 | # DocProject is a documentation generator add-in
141 | DocProject/buildhelp/
142 | DocProject/Help/*.HxT
143 | DocProject/Help/*.HxC
144 | DocProject/Help/*.hhc
145 | DocProject/Help/*.hhk
146 | DocProject/Help/*.hhp
147 | DocProject/Help/Html2
148 | DocProject/Help/html
149 |
150 | # Click-Once directory
151 | publish/
152 |
153 | # Publish Web Output
154 | *.[Pp]ublish.xml
155 | *.azurePubxml
156 | # TODO: Comment the next line if you want to checkin your web deploy settings
157 | # but database connection strings (with potential passwords) will be unencrypted
158 | *.pubxml
159 | *.publishproj
160 |
161 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
162 | # checkin your Azure Web App publish settings, but sensitive information contained
163 | # in these scripts will be unencrypted
164 | PublishScripts/
165 |
166 | # NuGet Packages
167 | *.nupkg
168 | # The packages folder can be ignored because of Package Restore
169 | **/packages/*
170 | # except build/, which is used as an MSBuild target.
171 | !**/packages/build/
172 | # Uncomment if necessary however generally it will be regenerated when needed
173 | #!**/packages/repositories.config
174 | # NuGet v3's project.json files produces more ignorable files
175 | *.nuget.props
176 | *.nuget.targets
177 |
178 | # Microsoft Azure Build Output
179 | csx/
180 | *.build.csdef
181 |
182 | # Microsoft Azure Emulator
183 | ecf/
184 | rcf/
185 |
186 | # Windows Store app package directories and files
187 | AppPackages/
188 | BundleArtifacts/
189 | Package.StoreAssociation.xml
190 | _pkginfo.txt
191 |
192 | # Visual Studio cache files
193 | # files ending in .cache can be ignored
194 | *.[Cc]ache
195 | # but keep track of directories ending in .cache
196 | !*.[Cc]ache/
197 |
198 | # Others
199 | ClientBin/
200 | ~$*
201 | *~
202 | *.dbmdl
203 | *.dbproj.schemaview
204 | *.jfm
205 | *.pfx
206 | *.publishsettings
207 | orleans.codegen.cs
208 |
209 | # Since there are multiple workflows, uncomment next line to ignore bower_components
210 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
211 | #bower_components/
212 |
213 | # RIA/Silverlight projects
214 | Generated_Code/
215 |
216 | # Backup & report files from converting an old project file
217 | # to a newer Visual Studio version. Backup files are not needed,
218 | # because we have git ;-)
219 | _UpgradeReport_Files/
220 | Backup*/
221 | UpgradeLog*.XML
222 | UpgradeLog*.htm
223 |
224 | # SQL Server files
225 | *.mdf
226 | *.ldf
227 | *.ndf
228 |
229 | # Business Intelligence projects
230 | *.rdl.data
231 | *.bim.layout
232 | *.bim_*.settings
233 |
234 | # Microsoft Fakes
235 | FakesAssemblies/
236 |
237 | # GhostDoc plugin setting file
238 | *.GhostDoc.xml
239 |
240 | # Node.js Tools for Visual Studio
241 | .ntvs_analysis.dat
242 | node_modules/
243 |
244 | # Typescript v1 declaration files
245 | typings/
246 |
247 | # Visual Studio 6 build log
248 | *.plg
249 |
250 | # Visual Studio 6 workspace options file
251 | *.opt
252 |
253 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
254 | *.vbw
255 |
256 | # Visual Studio LightSwitch build output
257 | **/*.HTMLClient/GeneratedArtifacts
258 | **/*.DesktopClient/GeneratedArtifacts
259 | **/*.DesktopClient/ModelManifest.xml
260 | **/*.Server/GeneratedArtifacts
261 | **/*.Server/ModelManifest.xml
262 | _Pvt_Extensions
263 |
264 | # Paket dependency manager
265 | .paket/paket.exe
266 | paket-files/
267 |
268 | # FAKE - F# Make
269 | .fake/
270 |
271 | # JetBrains Rider
272 | .idea/
273 | *.sln.iml
274 |
275 | # CodeRush
276 | .cr/
277 |
278 | # Python Tools for Visual Studio (PTVS)
279 | __pycache__/
280 | *.pyc
281 |
282 | # Cake - Uncomment if you are using it
283 | # tools/**
284 | # !tools/packages.config
285 |
286 | # Telerik's JustMock configuration file
287 | *.jmconfig
288 |
289 | # BizTalk build output
290 | *.btp.cs
291 | *.btm.cs
292 | *.odx.cs
293 | *.xsd.cs
294 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://ci.appveyor.com/project/Dirkster99/historycontrollib/branch/master)
2 | [](https://github.com/Dirkster99/MRULib/releases/latest)
3 | [](http://nuget.org/packages/Dirkster.HistoryControlLib)
4 |
5 |  
6 |
7 |
8 |
9 |  | HistoryControlLib |
10 |
11 |
12 |
13 | Implements a themable recent locations (forward, backward, up. pop-up list) control a la Windows (7-10) Explorer.
14 | These controls and viewmodels are re-used in the File System Controls project which in turn is integrated in Edi.
15 |
16 | The repository contains the sources for a Generic and a Dark and Light themed test client.
17 |
18 | The Locations Drop-Down button makes use of the **Segoe UI Symbol** font, which may not
19 | always be available on Windows 7. The font can either be installed via update from Microsoft of the drop down
20 | button definition for the down chevron can be replaced with a path definition.
21 |
22 | ## Navigate Back Direction
23 |
24 |
25 | ## Navigate Forward Direction
26 |
27 |
28 | ## Navigate Up
29 |
30 |
31 | ## Navigate within list of recently visited locations
32 |
33 |
34 | ## Theming
35 |
36 | Load *Light* or *Dark* brush resources in you resource dictionary to take advantage of existing definitions.
37 |
38 | ```XAML
39 |
40 |
41 |
42 | ```
43 |
44 | ```XAML
45 |
46 |
47 |
48 | ```
49 |
50 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 1.1.{build}
2 |
3 | branches:
4 | only:
5 | - master
6 |
7 | before_build:
8 | - cmd: nuget restore source/BrowseHistoryDemo.sln
9 |
10 | build:
11 | verbosity: minimal
12 |
13 | configuration: Release
14 |
15 | platform: Any CPU
16 |
17 | image: Visual Studio 2019 Preview
18 |
19 | install:
20 | - cmd: choco install dotnetcore-sdk --pre
21 |
22 | artifacts:
23 | - path: source\BrowseHistoryDemo\bin\Release
24 | name: BrowseHistoryDemo
25 |
26 | - path: source\BrowseHistoryThemesDemo\bin\Release
27 | name: BrowseHistoryThemesDemo
28 |
29 | - path: source\HistoryControlLib\bin\Release
30 | name: HistoryControlLib
31 |
--------------------------------------------------------------------------------
/source/BrowseHistoryDemo/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/source/BrowseHistoryDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/source/BrowseHistoryDemo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace BrowseHistoryDemo
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/source/BrowseHistoryDemo/BrowseHistoryDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {4D2E6726-2FCC-4085-97A0-AB77B8E78358}
8 | WinExe
9 | BrowseHistoryDemo
10 | BrowseHistoryDemo
11 | v4.6.1
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | 4.0
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | MSBuild:Compile
55 | Designer
56 |
57 |
58 | MSBuild:Compile
59 | Designer
60 |
61 |
62 | App.xaml
63 | Code
64 |
65 |
66 | MainWindow.xaml
67 | Code
68 |
69 |
70 |
71 |
72 | Code
73 |
74 |
75 | True
76 | True
77 | Resources.resx
78 |
79 |
80 | True
81 | Settings.settings
82 | True
83 |
84 |
85 | ResXFileCodeGenerator
86 | Resources.Designer.cs
87 |
88 |
89 | SettingsSingleFileGenerator
90 | Settings.Designer.cs
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | {d0ca35bb-2ec3-42d6-a329-d86ef8287dc7}
99 | BrowserHistoryDemoLib
100 |
101 |
102 | {93394321-71d7-47a8-86b5-76aff001c9a2}
103 | HistoryControlLib
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/source/BrowseHistoryDemo/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/source/BrowseHistoryDemo/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace BrowseHistoryDemo
2 | {
3 | using System.Windows;
4 |
5 | ///
6 | /// Interaction logic for MainWindow.xaml
7 | ///
8 | public partial class MainWindow : Window
9 | {
10 | public MainWindow()
11 | {
12 | InitializeComponent();
13 | Loaded += MainWindow_Loaded;
14 | }
15 |
16 | private void MainWindow_Loaded(object sender, RoutedEventArgs e)
17 | {
18 | var appVM = new BrowserHistoryDemoLib.ViewModels.AppViewModel();
19 | DataContext = appVM;
20 |
21 | appVM.Init();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/source/BrowseHistoryDemo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("BrowseHistoryDemo")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("BrowseHistoryDemo")]
15 | [assembly: AssemblyCopyright("Copyright © 2018")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/source/BrowseHistoryDemo/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BrowseHistoryDemo.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BrowseHistoryDemo.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/source/BrowseHistoryDemo/Properties/Resources.resx:
--------------------------------------------------------------------------------
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 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/source/BrowseHistoryDemo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BrowseHistoryDemo.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/source/BrowseHistoryDemo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/BindToMLib/HistoryControlLib/DarkLightBrushs.xaml:
--------------------------------------------------------------------------------
1 |
8 |
10 | #1ba1e2
12 |
13 |
17 |
18 |
22 |
23 |
27 |
28 |
32 |
33 |
37 |
38 |
42 |
43 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/BindToMLib/MWindowLib/DarkBrushs.xaml:
--------------------------------------------------------------------------------
1 |
9 |
11 | Blue
13 |
14 |
17 |
18 |
19 | #FFF4F4F5
21 |
22 | #FF2D2D30
24 |
25 |
28 |
29 |
32 |
33 |
34 | #FF3F3F41
36 |
37 |
40 |
41 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/BindToMLib/MWindowLib/LightBrushs.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
13 | Blue
15 |
16 |
19 |
20 |
21 | #FF000000
23 |
24 | #FFFFFFFF
26 |
27 |
30 |
31 |
34 |
35 |
36 | #403F3F41
38 |
39 |
42 |
43 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
28 |
29 |
30 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace BrowseHistoryThemesDemo
2 | {
3 | using MWindowLib;
4 | using Settings.UserProfile;
5 |
6 | ///
7 | /// Interaction logic for MainWindow.xaml
8 | ///
9 | public partial class MainWindow : SimpleMetroWindow, IViewSize
10 | {
11 | public MainWindow()
12 | {
13 | InitializeComponent();
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/Models/AppCore.cs:
--------------------------------------------------------------------------------
1 | namespace BrowseHistoryThemesDemo.Models
2 | {
3 | using System;
4 | using System.Globalization;
5 | using System.Reflection;
6 |
7 | ///
8 | /// Class supplies a set of common static helper methodes that help
9 | /// localizing application specific items such as setting folders etc.
10 | ///
11 | public class AppCore
12 | {
13 | #region properties
14 | ///
15 | /// Get the name of the executing assembly (usually name of *.exe file)
16 | ///
17 | internal static string AssemblyTitle
18 | {
19 | get
20 | {
21 | return Assembly.GetEntryAssembly().GetName().Name;
22 | }
23 | }
24 |
25 | //
26 | // Summary:
27 | // Gets the path or UNC location of the loaded file that contains the manifest.
28 | //
29 | // Returns:
30 | // The location of the loaded file that contains the manifest. If the loaded
31 | // file was shadow-copied, the location is that of the file after being shadow-copied.
32 | // If the assembly is loaded from a byte array, such as when using the System.Reflection.Assembly.Load(System.Byte[])
33 | // method overload, the value returned is an empty string ("").
34 | internal static string AssemblyEntryLocation
35 | {
36 | get
37 | {
38 | return System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
39 | }
40 | }
41 |
42 | ///
43 | /// Get a path to the directory where the user store his documents
44 | ///
45 | public static string MyDocumentsUserDir
46 | {
47 | get
48 | {
49 | return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
50 | }
51 | }
52 |
53 | public static string Company
54 | {
55 | get
56 | {
57 | return "MDemo";
58 | }
59 | }
60 | public static string Application_Title
61 | {
62 | get
63 | {
64 | return "MDemo";
65 | }
66 | }
67 |
68 | ///
69 | /// Get a path to the directory where the application
70 | /// can persist/load user data on session exit and re-start.
71 | ///
72 | public static string DirAppData
73 | {
74 | get
75 | {
76 | return Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
77 | System.IO.Path.DirectorySeparatorChar +
78 | AppCore.Company;
79 | }
80 | }
81 |
82 | //// ///
83 | //// /// Get path and file name to application specific settings file
84 | //// ///
85 | //// public static string DirFileAppSettingsData
86 | //// {
87 | //// get
88 | //// {
89 | //// return System.IO.Path.Combine(AppCore.DirAppData,
90 | //// string.Format(CultureInfo.InvariantCulture, "{0}.App.settings", AppCore.AssemblyTitle));
91 | //// }
92 | //// }
93 |
94 | ///
95 | /// Get path and file name to application specific session file
96 | ///
97 | public static string DirFileAppSessionData
98 | {
99 | get
100 | {
101 | return System.IO.Path.Combine(AppCore.DirAppData,
102 | string.Format(CultureInfo.InvariantCulture, "{0}.App.session", AppCore.AssemblyTitle));
103 | }
104 | }
105 | #endregion properties
106 |
107 | #region methods
108 | ///
109 | /// Create a dedicated directory to store program settings and session data
110 | ///
111 | ///
112 | public static bool CreateAppDataFolder()
113 | {
114 | try
115 | {
116 | if (System.IO.Directory.Exists(AppCore.DirAppData) == false)
117 | System.IO.Directory.CreateDirectory(AppCore.DirAppData);
118 | }
119 | catch
120 | {
121 | return false;
122 | }
123 |
124 | return true;
125 | }
126 | #endregion methods
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/Models/SettingDefaults.cs:
--------------------------------------------------------------------------------
1 | namespace BrowseHistoryThemesDemo.Models
2 | {
3 | using Settings.Interfaces;
4 | using SettingsModel.Interfaces;
5 | using System.Windows.Media;
6 |
7 | ///
8 | /// Class contains all methods necessary to initialize the applications settings model.
9 | ///
10 | internal static class SettingDefaults
11 | {
12 | ///
13 | /// Create the minimal settings model that should be used for every application.
14 | /// This model does not include advanced features like theming etc...
15 | ///
16 | ///
17 | public static void CreateGeneralSettings(IEngine options)
18 | {
19 | const string groupName = "Options";
20 |
21 | options.AddOption(groupName, "ReloadOpenFilesFromLastSession", typeof(bool), false, true);
22 | options.AddOption(groupName, "SourceFilePath", typeof(string), false, @"C:\temp\source\");
23 | options.AddOption(groupName, "LanguageSelected", typeof(string), false, "en-US");
24 |
25 | // var schema = optsEngine.AddListOption(groupName, "BookmarkedFolders", typeof(string), false, new List());
26 | // schema.List_AddValue(@"C:\TEMP", @"C:\TEMP");
27 | // schema.List_AddValue(@"C:\Windows", @"C:\Windows");
28 | }
29 |
30 | ///
31 | /// Create the minimal settings model that should be used for every application.
32 | ///
33 | ///
34 | public static void CreateAppearanceSettings(IEngine options, ISettingsManager settings)
35 | {
36 | const string groupName = "Appearance";
37 |
38 | options.AddOption(groupName, "ThemeDisplayName", typeof(string), false, "Dark");
39 | options.AddOption(groupName, "ApplyWindowsDefaultAccent", typeof(bool), false, true);
40 | options.AddOption(groupName, "AccentColor", typeof(Color), false, Color.FromRgb(0x33, 0x99, 0xff));
41 |
42 | // options.AddOption(groupName, "DefaultIconSize", typeof(int), false, settings.DefaultIconSize);
43 | // options.AddOption(groupName, "DefaultFontSize", typeof(int), false, settings.DefaultFontSize);
44 | // options.AddOption(groupName, "FixedFontSize", typeof(int), false, settings.DefaultFixedFontSize);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("BrowseHistoryThemesDemo")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("BrowseHistoryThemesDemo")]
15 | [assembly: AssemblyCopyright("Copyright © 2018")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BrowseHistoryThemesDemo.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BrowseHistoryThemesDemo.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/Properties/Resources.resx:
--------------------------------------------------------------------------------
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 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BrowseHistoryThemesDemo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/ServiceInjector.cs:
--------------------------------------------------------------------------------
1 | namespace BrowseHistoryThemesDemo
2 | {
3 | using MLib;
4 | using MLib.Interfaces;
5 | using ServiceLocator;
6 | using Settings;
7 | using Settings.Interfaces;
8 |
9 | ///
10 | /// Creates and initializes all services.
11 | ///
12 | public static class ServiceInjector
13 | {
14 | ///
15 | /// Loads service objects into the ServiceContainer on startup of application.
16 | ///
17 | /// Returns the current instance
18 | /// to let caller work with service container items right after creation.
19 | public static ServiceContainer InjectServices()
20 | {
21 | //// ServiceContainer.Instance.AddService(ContentDialogService.Instance);
22 |
23 | var appearance = AppearanceManager.GetInstance();
24 | ServiceContainer.Instance.AddService(SettingsManager.GetInstance(appearance.CreateThemeInfos()));
25 | ServiceContainer.Instance.AddService(appearance);
26 |
27 | return ServiceContainer.Instance;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/ViewModels/ThemeDefinitionViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace BrowseHistoryThemesDemo.ViewModels
2 | {
3 | using MLib.Themes;
4 |
5 | public class ThemeDefinitionViewModel : BrowserHistoryDemoLib.ViewModels.Base.BaseViewModel
6 | {
7 | #region private fields
8 | readonly private ThemeDefinition _model;
9 |
10 | private bool _IsSelected;
11 | #endregion private fields
12 |
13 | #region constructors
14 | public ThemeDefinitionViewModel(ThemeDefinition model)
15 | : this()
16 | {
17 | _model = model;
18 | }
19 |
20 | protected ThemeDefinitionViewModel()
21 | {
22 | _model = null;
23 | _IsSelected = false;
24 | }
25 | #endregion constructors
26 |
27 | #region properties
28 | ///
29 | /// Gets the static theme model based data items.
30 | ///
31 | public ThemeDefinition Model
32 | {
33 | get
34 | {
35 | return _model;
36 | }
37 | }
38 |
39 | ///
40 | /// Determines whether this theme is currently selected or not.
41 | ///
42 | public bool IsSelected
43 | {
44 | get { return _IsSelected; }
45 |
46 | set
47 | {
48 | if (_IsSelected != value)
49 | {
50 | _IsSelected = value;
51 | }
52 | }
53 | }
54 | #endregion properties
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/ViewModels/ThemeViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace BrowseHistoryThemesDemo.ViewModels
2 | {
3 | using MLib.Interfaces;
4 | using MLib.Themes;
5 | using Settings.Interfaces;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Windows;
9 | using System.Windows.Media;
10 |
11 | ///
12 | /// ViewModel class that manages theme properties for binding and display in WPF UI.
13 | ///
14 | public class ThemeViewModel : BrowserHistoryDemoLib.ViewModels.Base.BaseViewModel
15 | {
16 | #region private fields
17 | private readonly ThemeDefinitionViewModel _DefaultTheme = null;
18 | private Dictionary _ListOfThemes = null;
19 | private ThemeDefinitionViewModel _SelectedTheme = null;
20 | private bool _IsEnabled = true;
21 | #endregion private fields
22 |
23 | #region constructors
24 | ///
25 | /// Standard Constructor
26 | ///
27 | public ThemeViewModel()
28 | {
29 | var settings = GetService(); // add the default themes
30 |
31 | _ListOfThemes = new Dictionary();
32 |
33 | foreach (var item in settings.Themes.GetThemeInfos())
34 | {
35 | var list = new List();
36 | foreach (var subitem in item.ThemeSources)
37 | list.Add(subitem.ToString());
38 |
39 | _ListOfThemes.Add(item.DisplayName, new ThemeDefinitionViewModel(new ThemeDefinition(item.DisplayName, list)));
40 | }
41 |
42 | // Lets make sure there is a default
43 | _ListOfThemes.TryGetValue(GetService().GetDefaultTheme().DisplayName, out _DefaultTheme);
44 |
45 | // and something sensible is selected
46 | _SelectedTheme = _DefaultTheme;
47 | _SelectedTheme.IsSelected = true;
48 | }
49 | #endregion constructors
50 |
51 | #region properties
52 | ///
53 | /// Returns a default theme that should be applied when nothing else is available.
54 | ///
55 | public ThemeDefinitionViewModel DefaultTheme
56 | {
57 | get
58 | {
59 | return _DefaultTheme;
60 | }
61 | }
62 |
63 | ///
64 | /// Returns a list of theme definitons.
65 | ///
66 | public List ListOfThemes
67 | {
68 | get
69 | {
70 | return _ListOfThemes.Select(it => it.Value).ToList();
71 | }
72 | }
73 |
74 | ///
75 | /// Gets the currently selected theme (or desfault on applaiction start-up)
76 | ///
77 | public ThemeDefinitionViewModel SelectedTheme
78 | {
79 | get
80 | {
81 | return _SelectedTheme;
82 | }
83 |
84 | private set
85 | {
86 | if (_SelectedTheme != value)
87 | {
88 | if (_SelectedTheme != null)
89 | _SelectedTheme.IsSelected = false;
90 |
91 | _SelectedTheme = value;
92 |
93 | if (_SelectedTheme != null)
94 | _SelectedTheme.IsSelected = true;
95 |
96 | this.NotifyPropertyChanged(() => this.SelectedTheme);
97 | }
98 | }
99 | }
100 |
101 | ///
102 | /// Gets whether a different theme can be selected right now or not.
103 | /// This property should be bound to the UI that selects a different
104 | /// theme to avoid the case in which a user could select a theme and
105 | /// select a different theme while the first theme change request is
106 | /// still processed.
107 | ///
108 | public bool IsEnabled
109 | {
110 | get { return _IsEnabled; }
111 |
112 | private set
113 | {
114 | if (_IsEnabled != value)
115 | {
116 | _IsEnabled = value;
117 | NotifyPropertyChanged(() => IsEnabled);
118 | }
119 | }
120 | }
121 | #endregion properties
122 |
123 | #region methods
124 | ///
125 | /// Applies a new theme based on the changed selection in the input element.
126 | ///
127 | ///
128 | public void ApplyTheme(FrameworkElement fe, string themeName)
129 | {
130 | if (themeName != null)
131 | {
132 | IsEnabled = false;
133 | try
134 | {
135 | var settings = GetService(); // add the default themes
136 |
137 | Color AccentColor = ThemeViewModel.GetCurrentAccentColor(settings);
138 | GetService().SetTheme(settings.Themes, themeName, AccentColor);
139 |
140 | ThemeDefinitionViewModel o;
141 | _ListOfThemes.TryGetValue(themeName, out o);
142 | SelectedTheme = o;
143 | }
144 | catch
145 | {
146 | }
147 | finally
148 | {
149 | IsEnabled = true;
150 | }
151 | }
152 | }
153 |
154 | public static Color GetCurrentAccentColor(ISettingsManager settings)
155 | {
156 | Color AccentColor;
157 |
158 | if (settings.Options.GetOptionValue("Appearance", "ApplyWindowsDefaultAccent"))
159 | AccentColor = SystemParameters.WindowGlassColor;
160 | else
161 | AccentColor = settings.Options.GetOptionValue("Appearance", "AccentColor");
162 |
163 | return AccentColor;
164 | }
165 |
166 | ///
167 | /// This method gets the service locator instance
168 | /// that is used in turn to get an application specific service instance.
169 | ///
170 | ///
171 | ///
172 | private TServiceContract GetService() where TServiceContract : class
173 | {
174 | return ServiceLocator.ServiceContainer.Instance.GetService();
175 | }
176 | #endregion methods
177 | }
178 | }
179 |
--------------------------------------------------------------------------------
/source/BrowseHistoryThemesDemo/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/source/BrowserHistoryDemoLib/BrowserHistoryDemoLib.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D0CA35BB-2EC3-42D6-A329-D86EF8287DC7}
8 | Library
9 | Properties
10 | BrowserHistoryDemoLib
11 | BrowserHistoryDemoLib
12 | v4.0
13 | 512
14 | Client
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | BrowseHistoryDebugView.xaml
55 |
56 |
57 | BrowseHistoryDemoControl.xaml
58 |
59 |
60 |
61 |
62 | Designer
63 | MSBuild:Compile
64 |
65 |
66 | Designer
67 | MSBuild:Compile
68 |
69 |
70 |
71 |
72 | {93394321-71d7-47a8-86b5-76aff001c9a2}
73 | HistoryControlLib
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/source/BrowserHistoryDemoLib/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("BrowserHistoryDemoLib")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("BrowserHistoryDemoLib")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("d0ca35bb-2ec3-42d6-a329-d86ef8287dc7")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/source/BrowserHistoryDemoLib/ViewModels/Base/BaseViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace BrowserHistoryDemoLib.ViewModels.Base
2 | {
3 | using System;
4 | using System.ComponentModel;
5 | using System.Linq.Expressions;
6 |
7 | ///
8 | /// Every ViewModel class is required to implement the INotifyPropertyChanged
9 | /// interface in order to tell WPF when a property changed (for instance, when
10 | /// a method or setter is executed).
11 | ///
12 | /// Therefore, the PropertyChanged methode has to be called when data changes,
13 | /// because the relevant properties may or may not be bound to GUI elements,
14 | /// which in turn have to refresh their display.
15 | ///
16 | /// The PropertyChanged method is to be called by the members and properties of
17 | /// the class that derives from this class. Each call contains the name of the
18 | /// property that has to be refreshed.
19 | ///
20 | /// The BaseViewModel is derived from from System.Windows.DependencyObject to allow
21 | /// resulting ViewModels the implemantion of dependency properties. Dependency properties
22 | /// in turn are useful when working with IValueConverter and ConverterParameters.
23 | ///
24 | public class BaseViewModel : INotifyPropertyChanged
25 | {
26 | ///
27 | /// Standard event handler of the interface
28 | ///
29 | public event PropertyChangedEventHandler PropertyChanged;
30 |
31 | ///
32 | /// Tell bound controls (via WPF binding) to refresh their display.
33 | ///
34 | /// Sample call: this.NotifyPropertyChanged(() => this.IsSelected);
35 | /// where 'this' is derived from
36 | /// and IsSelected is a property.
37 | ///
38 | ///
39 | ///
40 | public void NotifyPropertyChanged(Expression> property)
41 | {
42 | var lambda = (LambdaExpression)property;
43 | MemberExpression memberExpression;
44 |
45 | if (lambda.Body is UnaryExpression)
46 | {
47 | var unaryExpression = (UnaryExpression)lambda.Body;
48 | memberExpression = (MemberExpression)unaryExpression.Operand;
49 | }
50 | else
51 | memberExpression = (MemberExpression)lambda.Body;
52 |
53 | this.OnPropertyChanged(memberExpression.Member.Name);
54 | }
55 |
56 | ///
57 | /// Tell bound controls (via WPF binding) to refresh their display.
58 | ///
59 | /// Sample call: this.OnPropertyChanged("IsSelected");
60 | /// where 'this' is derived from
61 | /// and IsSelected is a property.
62 | ///
63 | /// Name of property to refresh
64 | private void OnPropertyChanged(string propertyName)
65 | {
66 | try
67 | {
68 | var handler = this.PropertyChanged;
69 |
70 | if (handler != null)
71 | handler(this, new PropertyChangedEventArgs(propertyName));
72 | }
73 | catch
74 | {
75 | }
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/source/BrowserHistoryDemoLib/ViewModels/Base/RelayCommand.cs:
--------------------------------------------------------------------------------
1 | namespace BrowserHistoryDemoLib.ViewModels.Base
2 | {
3 | using System;
4 | using System.Diagnostics;
5 | using System.Windows.Input;
6 |
7 | ///
8 | /// A class whose sole purpose is to relay its functionality to other
9 | /// objects by invoking delegates.
10 | ///
11 | /// The default return value for the CanExecute method is 'true'.
12 | ///
13 | /// Source: http://www.codeproject.com/Articles/31837/Creating-an-Internationalized-Wizard-in-WPF
14 | ///
15 | public class RelayCommand : ICommand
16 | {
17 | #region Fields
18 | private readonly Action mExecute = null;
19 | private readonly Predicate mCanExecute = null;
20 | #endregion // Fields
21 |
22 | #region Constructors
23 | ///
24 | /// Class constructor
25 | ///
26 | ///
27 | public RelayCommand(Action execute)
28 | : this(execute, null)
29 | {
30 | }
31 |
32 | ///
33 | /// Creates a new command.
34 | ///
35 | /// The execution logic.
36 | /// The execution status logic.
37 | public RelayCommand(Action execute, Predicate canExecute)
38 | {
39 | if (execute == null)
40 | throw new ArgumentNullException("execute");
41 |
42 | this.mExecute = execute;
43 | this.mCanExecute = canExecute;
44 | }
45 |
46 | #endregion // Constructors
47 |
48 | #region events
49 | ///
50 | /// Eventhandler to re-evaluate whether this command can execute or not
51 | ///
52 | public event EventHandler CanExecuteChanged
53 | {
54 | add
55 | {
56 | if (this.mCanExecute != null)
57 | CommandManager.RequerySuggested += value;
58 | }
59 |
60 | remove
61 | {
62 | if (this.mCanExecute != null)
63 | CommandManager.RequerySuggested -= value;
64 | }
65 | }
66 | #endregion
67 |
68 | #region methods
69 | ///
70 | /// Determine whether this pre-requisites to execute this command are given or not.
71 | ///
72 | ///
73 | ///
74 | [DebuggerStepThrough]
75 | public bool CanExecute(object parameter)
76 | {
77 | return this.mCanExecute == null ? true : this.mCanExecute((T)parameter);
78 | }
79 |
80 | ///
81 | /// Execute the command method managed in this class.
82 | ///
83 | ///
84 | public void Execute(object parameter)
85 | {
86 | this.mExecute((T)parameter);
87 | }
88 | #endregion methods
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/source/BrowserHistoryDemoLib/ViewModels/LocationItem.cs:
--------------------------------------------------------------------------------
1 | namespace BrowserHistoryDemoLib.ViewModels
2 | {
3 | using System.Collections.Generic;
4 |
5 | ///
6 | /// Implements a sample location item that demos how a location
7 | /// can be recorded, handled, and logged in an application.
8 | ///
9 | public class LocationItem : IEqualityComparer
10 | {
11 | #region ctors
12 | ///
13 | /// Class constructor.
14 | ///
15 | ///
16 | public LocationItem(string path)
17 | : this()
18 | {
19 | Path = path;
20 | }
21 |
22 | ///
23 | /// Hidden class constructor.
24 | ///
25 | protected LocationItem()
26 | {
27 | }
28 | #endregion ctors
29 |
30 | ///
31 | /// Gets a path to a location that is indicated by this object.
32 | ///
33 | public string Path { get; }
34 |
35 | #region methods
36 | ///
37 | /// Determines whether 2 objects are in holding the same information or not.
38 | /// Implements the interface.
39 | ///
40 | /// Method is used in the .Forward() method
41 | /// implementation to reduce redundancies in multiple requests for browsing
42 | /// to the same (current) loaction. The equality is used here too determine
43 | /// what the same location is and stop adding another location when the previously
44 | /// added location is the same as the current location.
45 | ///
46 | ///
47 | ///
48 | ///
49 | public bool Equals(LocationItem parx, LocationItem pary)
50 | {
51 | if (parx == null && pary != null || parx != null && pary == null)
52 | return false;
53 |
54 | return string.Compare(parx.Path, pary.Path, true) == 0;
55 | }
56 |
57 | ///
58 | /// Gets the hashcode of this object.
59 | /// Implements the interface.
60 | ///
61 | ///
62 | ///
63 | public int GetHashCode(LocationItem obj)
64 | {
65 | return obj.GetHashCode();
66 | }
67 |
68 | ///
69 | /// Determines whether 2 objects are holding the same information or not.
70 | ///
71 | ///
72 | ///
73 | ///
74 | public new bool Equals(object x, object y)
75 | {
76 | return Equals(x as LocationItem, y as LocationItem);
77 | }
78 |
79 | ///
80 | /// Gets the hashcode of this object.
81 | ///
82 | ///
83 | ///
84 | public int GetHashCode(object obj)
85 | {
86 | return GetHashCode(obj as LocationItem);
87 | }
88 | #endregion methods
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/source/BrowserHistoryDemoLib/Views/BrowseHistoryDebugView.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
36 |
37 |
38 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/source/BrowserHistoryDemoLib/Views/BrowseHistoryDebugView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace BrowserHistoryDemoLib.Views
16 | {
17 | ///
18 | /// Interaction logic for BrowseHistoryDebugView.xaml
19 | ///
20 | public partial class BrowseHistoryDebugView : UserControl
21 | {
22 | public BrowseHistoryDebugView()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/source/BrowserHistoryDemoLib/Views/BrowseHistoryDemoControl.xaml:
--------------------------------------------------------------------------------
1 |
9 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
53 |
54 |
84 |
85 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/source/BrowserHistoryDemoLib/Views/BrowseHistoryDemoControl.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace BrowserHistoryDemoLib.Views
2 | {
3 | using System.Windows.Controls;
4 |
5 | ///
6 | /// Interaction logic for BrowseHistoryDemoView.xaml
7 | ///
8 | public partial class BrowseHistoryDemoControl : UserControl
9 | {
10 | public BrowseHistoryDemoControl()
11 | {
12 | InitializeComponent();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/source/CleanAll.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 | pushd "%~dp0"
3 | ECHO.
4 | ECHO.
5 | ECHO.
6 | ECHO This script deletes all temporary build files in the .vs folder and the
7 | ECHO BIN and OBJ folders contained in the following projects
8 | ECHO.
9 | ECHO HistoryControlLib
10 | ECHO BrowseHistoryDemo
11 | ECHO BrowserHistoryDemoLib
12 | ECHO BrowseHistoryThemesDemo
13 | ECHO BrowseHistoryDemo
14 | ECHO.
15 | ECHO Components\ServiceLocator
16 | ECHO Components\Settings\Settings
17 | ECHO Components\Settings\SettingsModel
18 | ECHO.
19 | REM Ask the user if hes really sure to continue beyond this point XXXXXXXX
20 | set /p choice=Are you sure to continue (Y/N)?
21 | if not '%choice%'=='Y' Goto EndOfBatch
22 | REM Script does not continue unless user types 'Y' in upper case letter
23 | ECHO.
24 | ECHO XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
25 | ECHO.
26 | ECHO XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
27 | ECHO.
28 | ECHO Removing vs settings folder with *.sou file
29 | ECHO.
30 | RMDIR /S /Q .vs
31 |
32 | ECHO.
33 | ECHO Deleting BIN and OBJ Folders in HistoryControlLib
34 | ECHO.
35 | RMDIR /S /Q "HistoryControlLib\bin"
36 | RMDIR /S /Q "HistoryControlLib\obj"
37 |
38 | ECHO.
39 | ECHO Deleting BIN and OBJ Folders in BrowseHistoryDemo
40 | ECHO.
41 | RMDIR /S /Q "BrowseHistoryDemo\bin"
42 | RMDIR /S /Q "BrowseHistoryDemo\obj"
43 |
44 | ECHO.
45 | ECHO Deleting BIN and OBJ Folders in BrowserHistoryDemoLib
46 | ECHO.
47 | RMDIR /S /Q "BrowserHistoryDemoLib\bin"
48 | RMDIR /S /Q "BrowserHistoryDemoLib\obj"
49 |
50 | ECHO.
51 | ECHO Deleting BIN and OBJ Folders in BrowseHistoryThemesDemo
52 | ECHO.
53 | RMDIR /S /Q "BrowseHistoryThemesDemo\bin"
54 | RMDIR /S /Q "BrowseHistoryThemesDemo\obj"
55 |
56 | ECHO.
57 | ECHO Deleting BIN and OBJ Folders in BrowseHistoryDemo
58 | ECHO.
59 | RMDIR /S /Q "BrowseHistoryDemo\bin"
60 | RMDIR /S /Q "BrowseHistoryDemo\obj"
61 |
62 | ECHO.
63 | ECHO Deleting BIN and OBJ Folders in Components\ServiceLocator
64 | ECHO.
65 | RMDIR /S /Q "Components\ServiceLocator\bin"
66 | RMDIR /S /Q "Components\ServiceLocator\obj"
67 |
68 | ECHO.
69 | ECHO Deleting BIN and OBJ Folders in Components\Settings\Settings
70 | ECHO.
71 | RMDIR /S /Q "Components\Settings\Settings\bin"
72 | RMDIR /S /Q "Components\Settings\Settings\obj"
73 |
74 | ECHO.
75 | ECHO Deleting BIN and OBJ Folders in Components\Settings\SettingsModel
76 | ECHO.
77 | RMDIR /S /Q "Components\Settings\SettingsModel\bin"
78 | RMDIR /S /Q "Components\Settings\SettingsModel\obj"
79 |
80 | PAUSE
81 |
82 | :EndOfBatch
83 |
--------------------------------------------------------------------------------
/source/Components/ServiceLocator/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("ServiceLocator")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("HP")]
12 | [assembly: AssemblyProduct("ServiceLocator")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("2516097b-2435-44a4-a9b8-9899bca81a6e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/source/Components/ServiceLocator/ServiceContainer.cs:
--------------------------------------------------------------------------------
1 | namespace ServiceLocator
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | ///
7 | /// Source: http://www.codeproject.com/Articles/70223/Using-a-Service-Locator-to-Work-with-MessageBoxes
8 | ///
9 | public class ServiceContainer
10 | {
11 | #region fields
12 | public static readonly ServiceContainer Instance = new ServiceContainer();
13 |
14 | readonly Dictionary _serviceMap;
15 | readonly object _serviceMapLock;
16 | #endregion fields
17 |
18 | #region constructors
19 | ///
20 | /// Class Constructor
21 | ///
22 | private ServiceContainer()
23 | {
24 | _serviceMap = new Dictionary();
25 | _serviceMapLock = new object();
26 | }
27 | #endregion constructors
28 |
29 | #region methods
30 | public void AddService(TServiceContract implementation)
31 | where TServiceContract : class
32 | {
33 | lock (_serviceMapLock)
34 | {
35 | _serviceMap[typeof(TServiceContract)] = implementation;
36 | }
37 | }
38 |
39 | public TServiceContract GetService()
40 | where TServiceContract : class
41 | {
42 | object service;
43 | lock (_serviceMapLock)
44 | {
45 | _serviceMap.TryGetValue(typeof(TServiceContract), out service);
46 | }
47 |
48 | return service as TServiceContract;
49 | }
50 | #endregion methods
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/source/Components/ServiceLocator/ServiceLocator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {252126D1-E1D9-49C3-910B-FCF2266265EF}
8 | Library
9 | Properties
10 | ServiceLocator
11 | ServiceLocator
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 | true
34 | bin\x64\Debug\
35 | DEBUG;TRACE
36 | full
37 | x64
38 | prompt
39 | MinimumRecommendedRules.ruleset
40 |
41 |
42 | bin\x64\Release\
43 | TRACE
44 | true
45 | pdbonly
46 | x64
47 | prompt
48 | MinimumRecommendedRules.ruleset
49 |
50 |
51 | true
52 | bin\x86\Debug\
53 | DEBUG;TRACE
54 | full
55 | x86
56 | prompt
57 | MinimumRecommendedRules.ruleset
58 |
59 |
60 | bin\x86\Release\
61 | TRACE
62 | true
63 | pdbonly
64 | x86
65 | prompt
66 | MinimumRecommendedRules.ruleset
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
87 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/Interfaces/IOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Settings.Interfaces
2 | {
3 | using Settings.ProgramSettings;
4 | using System.Collections.Generic;
5 |
6 | public interface IOptions
7 | {
8 | #region properties
9 | bool IsDirty { get; set; }
10 | string LanguageSelected { get; set; }
11 | bool ReloadOpenFilesOnAppStart { get; set; }
12 | string SourceFilePath { get; set; }
13 |
14 | string DefaultSourceLanguage { get; set; }
15 | string DefaultTargetLanguage { get; set; }
16 |
17 | string DefaultDefaultSourceLanguage { get; }
18 | string DefaultDefaultTargetLanguage { get; }
19 |
20 | int DefaultIconSize { get; }
21 | int IconSizeMin { get; }
22 | int IconSizeMax { get; }
23 |
24 | int DefaultFontSize { get; }
25 | int FontSizeMin { get; }
26 | int FontSizeMax { get; }
27 | #endregion properties
28 |
29 | #region methods
30 | ///
31 | /// Reset the dirty flag (e.g. after saving program options when they where edit).
32 | ///
33 | ///
34 | void SetDirtyFlag(bool flag);
35 |
36 | void SetIconSize(int size);
37 | void SetFontSize(int size);
38 | #endregion methods
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/Interfaces/IOptionsPanel.cs:
--------------------------------------------------------------------------------
1 | namespace Settings.Interfaces
2 | {
3 | using SettingsModel.Interfaces;
4 |
5 | public interface IOptionsPanel
6 | {
7 | IEngine Options { get; }
8 | }
9 | }
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/Interfaces/IProfile.cs:
--------------------------------------------------------------------------------
1 | namespace Settings.Interfaces
2 | {
3 | using Settings.UserProfile;
4 | using SettingsModel.Models;
5 | using System;
6 | using System.Collections.Generic;
7 |
8 | public interface IProfile
9 | {
10 | #region properties
11 | string GetLastActivePath();
12 | string LastActiveSolution { get; set; }
13 |
14 |
15 | string LastActiveTargetFile { get; set; }
16 |
17 | List LastActiveSourceFiles { get; set; }
18 |
19 | ///
20 | /// Gets the key name of the MainWindow item in the collection.
21 | /// Ths name can be used as key in the WindowPosSz property
22 | /// to read and write MainWindow position and size information.
23 | ///
24 | string MainWindowName { get; }
25 |
26 | ///
27 | /// Gets a collection of window position and size items.
28 | ///
29 | SerializableDictionary WindowPosSz { get; }
30 | #endregion properties
31 |
32 | #region methods
33 | ///
34 | /// Checks the MainWindow for visibility when re-starting application
35 | /// (with different screen configuration).
36 | ///
37 | ///
38 | ///
39 | void CheckSettingsOnLoad(double SystemParameters_VirtualScreenLeft, double SystemParameters_VirtualScreenTop);
40 |
41 | ///
42 | /// Updates or inserts the requested window pos size item in the collection.
43 | ///
44 | ///
45 | ///
46 | ///
47 | void UpdateInsertWindowPosSize(string windowName, ViewPosSizeModel model);
48 | #endregion methods
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/Interfaces/ISettingsManager.cs:
--------------------------------------------------------------------------------
1 | namespace Settings.Interfaces
2 | {
3 | using Settings.ProgramSettings;
4 | using MLib.Interfaces;
5 | using System.Collections.Generic;
6 | using System.Xml.Serialization;
7 |
8 | public interface ISettingsManager : IOptionsPanel
9 | {
10 | void CheckSettingsOnLoad(double SystemParameters_VirtualScreenLeft, double SystemParameters_VirtualScreenTop);
11 |
12 | ////void LoadOptions(string settingsFileName);
13 | void LoadSessionData(string sessionDataFileName);
14 |
15 | ////bool SaveOptions(string settingsFileName, Settings.Interfaces.IOptions optionsModel);
16 | bool SaveSessionData(string sessionDataFileName, Settings.Interfaces.IProfile model);
17 |
18 | ///
19 | /// Get a list of all supported languages in Edi.
20 | ///
21 | ///
22 | IEnumerable GetSupportedLanguages();
23 |
24 | #region properties
25 | Settings.Interfaces.IProfile SessionData { get; }
26 |
27 | int IconSizeMin { get; }
28 | int IconSizeMax { get; }
29 |
30 | int FontSizeMin { get; }
31 | int FontSizeMax { get; }
32 |
33 | ///
34 | /// Gets the default icon size for the application.
35 | ///
36 | int DefaultIconSize { get; }
37 |
38 | ///
39 | /// Gets the default font size for the application.
40 | ///
41 | int DefaultFontSize { get; }
42 |
43 | ///
44 | /// Gets the default fixed font size for the application.
45 | ///
46 | int DefaultFixedFontSize { get; }
47 |
48 | ///
49 | /// Gets the internal name and Uri source for all available themes.
50 | ///
51 | [XmlIgnore]
52 | IThemeInfos Themes { get; }
53 | #endregion properties
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/Interfaces/IViewPosSizeModel.cs:
--------------------------------------------------------------------------------
1 | namespace Settings.Interfaces
2 | {
3 | using System;
4 |
5 | public interface IViewPosSizeModel
6 | {
7 | bool DefaultConstruct { get; }
8 | double Height { get; set; }
9 | bool IsMaximized { get; set; }
10 | double Width { get; set; }
11 | double X { get; set; }
12 | double Y { get; set; }
13 |
14 | void SetValidPos(double SystemParameters_VirtualScreenLeft, double SystemParameters_VirtualScreenTop);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/ProgramSettings/LanguageCollection.cs:
--------------------------------------------------------------------------------
1 | namespace Settings.ProgramSettings
2 | {
3 | using System;
4 |
5 | ///
6 | /// Base class for enumeration over languages (and their locale) that
7 | /// are supported with specific (non-English) button and tool tip strings.
8 | ///
9 | /// The class definition is based on BCP 47 which in turn is used to
10 | /// set the UI and thread culture (which in turn selects the correct
11 | /// string resource in MsgBox assembly).
12 | ///
13 | public class LanguageCollection
14 | {
15 | public string Language { get; set; }
16 | public string Locale { get; set; }
17 | public string Name { get; set; }
18 |
19 | ///
20 | /// Get BCP47 language tag for this language
21 | /// See also http://en.wikipedia.org/wiki/IETF_language_tag
22 | ///
23 | public string BCP47
24 | {
25 | get
26 | {
27 | if (string.IsNullOrEmpty(Locale) == false)
28 | return String.Format("{0}-{1}", Language, Locale);
29 | else
30 | return String.Format("{0}", Language);
31 | }
32 | }
33 |
34 | ///
35 | /// Get BCP47 language tag for this language
36 | /// See also http://en.wikipedia.org/wiki/IETF_language_tag
37 | ///
38 | public string DisplayName
39 | {
40 | get
41 | {
42 | return String.Format("{0} {1}", Name, BCP47);
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/ProgramSettings/OptionsPanel.cs:
--------------------------------------------------------------------------------
1 | namespace Settings.ProgramSettings
2 | {
3 | using Settings.Interfaces;
4 | using SettingsModel.Interfaces;
5 | using SettingsModel.Models;
6 |
7 | internal class OptionsPanel : IOptionsPanel
8 | {
9 | private IEngine mQuery = null;
10 |
11 | public OptionsPanel()
12 | {
13 | mQuery = Factory.CreateEngine();
14 | }
15 |
16 | ///
17 | /// Gets the options that used to manage program options.
18 | ///
19 | public IEngine Options
20 | {
21 | get
22 | {
23 | return mQuery;
24 | }
25 |
26 | private set
27 | {
28 | mQuery = value;
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/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("Settings")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("HP")]
12 | [assembly: AssemblyProduct("Settings")]
13 | [assembly: AssemblyCopyright("The MIT License (MIT) Copyright © 2013 - 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("7f13f2b5-a017-4045-8ead-f5496101a616")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/SerializableDictionary.cs:
--------------------------------------------------------------------------------
1 | namespace Settings
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Globalization;
6 | using System.Runtime.Serialization;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 |
10 | ///
11 | /// This class represents a serializable dictionary implementation
12 | /// of the standard generic dictionary class in .Net.
13 | ///
14 | /// Source: http://www.jankowskimichal.pl/en/2010/10/serializabledictionary/
15 | ///
16 | [Serializable]
17 | public class SerializableDictionary : Dictionary, IXmlSerializable, ISerializable
18 | {
19 | #region Private Members
20 | private XmlSerializer _keySerializer;
21 | private XmlSerializer _valueSerializer;
22 | #endregion
23 |
24 | #region Constructors
25 | public SerializableDictionary()
26 | {
27 | }
28 |
29 | public SerializableDictionary(IDictionary dictionary)
30 | : base(dictionary)
31 | {
32 | }
33 |
34 | public SerializableDictionary(IEqualityComparer comparer)
35 | : base(comparer)
36 | {
37 | }
38 |
39 | public SerializableDictionary(int capacity)
40 | : base(capacity)
41 | {
42 | }
43 |
44 | public SerializableDictionary(IDictionary dictionary, IEqualityComparer comparer)
45 | : base(dictionary, comparer)
46 | {
47 | }
48 |
49 | public SerializableDictionary(int capacity, IEqualityComparer comparer)
50 | : base(capacity, comparer)
51 | {
52 | }
53 |
54 | #endregion
55 |
56 | #region Private Properties
57 | protected XmlSerializer ValueSerializer
58 | {
59 | get { return _valueSerializer ?? (_valueSerializer = new XmlSerializer(typeof(TVal))); }
60 | }
61 |
62 | private XmlSerializer KeySerializer
63 | {
64 | get { return _keySerializer ?? (_keySerializer = new XmlSerializer(typeof(TKey))); }
65 | }
66 | #endregion
67 |
68 | #region ISerializable Members
69 | protected SerializableDictionary(SerializationInfo info, StreamingContext context)
70 | {
71 | int itemCount = info.GetInt32("itemsCount");
72 | for (int i = 0; i < itemCount; i++)
73 | {
74 | KeyValuePair kvp = (KeyValuePair)info.GetValue(String.Format(CultureInfo.InvariantCulture, "Item{0}", i), typeof(KeyValuePair));
75 | Add(kvp.Key, kvp.Value);
76 | }
77 | }
78 |
79 | void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
80 | {
81 | info.AddValue("itemsCount", Count);
82 | int itemIdx = 0;
83 | foreach (KeyValuePair kvp in this)
84 | {
85 | info.AddValue(String.Format(CultureInfo.InvariantCulture, "Item{0}", itemIdx), kvp, typeof(KeyValuePair));
86 | itemIdx++;
87 | }
88 | }
89 | #endregion
90 |
91 | #region IXmlSerializable Members
92 | void IXmlSerializable.WriteXml(XmlWriter writer)
93 | {
94 | foreach (KeyValuePair kvp in this)
95 | {
96 | writer.WriteStartElement("item");
97 | writer.WriteStartElement("key");
98 | KeySerializer.Serialize(writer, kvp.Key);
99 | writer.WriteEndElement();
100 | writer.WriteStartElement("value");
101 | ValueSerializer.Serialize(writer, kvp.Value);
102 | writer.WriteEndElement();
103 | writer.WriteEndElement();
104 | }
105 | }
106 |
107 | void IXmlSerializable.ReadXml(XmlReader reader)
108 | {
109 | if (reader.IsEmptyElement)
110 | {
111 | return;
112 | }
113 | // Move past container
114 | if (reader.NodeType == XmlNodeType.Element && !reader.Read())
115 | {
116 | throw new XmlException("Error in Deserialization of SerializableDictionary");
117 | }
118 | while (reader.NodeType != XmlNodeType.EndElement)
119 | {
120 | reader.ReadStartElement("item");
121 | reader.ReadStartElement("key");
122 | TKey key = (TKey)KeySerializer.Deserialize(reader);
123 | reader.ReadEndElement();
124 | reader.ReadStartElement("value");
125 | TVal value = (TVal)ValueSerializer.Deserialize(reader);
126 | reader.ReadEndElement();
127 | reader.ReadEndElement();
128 | Add(key, value);
129 | reader.MoveToContent();
130 | }
131 | // Move past container
132 | if (reader.NodeType == XmlNodeType.EndElement)
133 | {
134 | reader.ReadEndElement();
135 | }
136 | else
137 | {
138 | throw new XmlException("Error in Deserialization of SerializableDictionary");
139 | }
140 | }
141 |
142 | System.Xml.Schema.XmlSchema IXmlSerializable.GetSchema()
143 | {
144 | return null;
145 | }
146 | #endregion
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/Settings.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {2807B493-CC2E-402E-901A-EB138698FEDC}
8 | Library
9 | Properties
10 | Settings
11 | Settings
12 | v4.5.2
13 | 512
14 |
15 |
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 | false
26 |
27 |
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 | false
35 |
36 |
37 | true
38 | bin\x86\Debug\
39 | DEBUG;TRACE
40 | full
41 | x86
42 | prompt
43 | ManagedMinimumRules.ruleset
44 | false
45 |
46 |
47 | bin\x86\Release\
48 | TRACE
49 | true
50 | pdbonly
51 | x86
52 | prompt
53 | ManagedMinimumRules.ruleset
54 | false
55 |
56 |
57 | true
58 | bin\x64\Debug\
59 | DEBUG;TRACE
60 | full
61 | x64
62 | prompt
63 | MinimumRecommendedRules.ruleset
64 |
65 |
66 | bin\x64\Release\
67 | TRACE
68 | true
69 | pdbonly
70 | x64
71 | prompt
72 | MinimumRecommendedRules.ruleset
73 |
74 |
75 |
76 | ..\..\..\packages\log4net.2.0.8\lib\net45-full\log4net.dll
77 |
78 |
79 | ..\..\..\packages\Dirkster.MLib.1.0.9.1\lib\net4\MLib.dll
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 |
110 | {9b0ba841-5a2f-4ed3-a908-253dbca70e77}
111 | SettingsModel
112 |
113 |
114 |
115 |
116 |
117 |
118 |
125 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/SettingsManager.cs:
--------------------------------------------------------------------------------
1 | namespace Settings
2 | {
3 | using MLib.Interfaces;
4 | using Settings.Interfaces;
5 | using Settings.Internal;
6 |
7 | ///
8 | /// Helper class to initialize an
9 | /// service interface.
10 | ///
11 | public sealed class SettingsManager
12 | {
13 | ///
14 | /// Hidden default constructor.
15 | ///
16 | private SettingsManager()
17 | {
18 | }
19 |
20 | ///
21 | /// Gets an instance of an object that implements the
22 | /// interface.
23 | ///
24 | ///
25 | public static ISettingsManager GetInstance(IThemeInfos themeInfos)
26 | {
27 | return new SettingsManagerImpl(themeInfos);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/UserProfile/IViewSize.cs:
--------------------------------------------------------------------------------
1 | namespace Settings.UserProfile
2 | {
3 | using System.Windows;
4 |
5 | ///
6 | /// Provide an interface to implement saving and loading/repositioning of Window or view.
7 | ///
8 | public interface IViewSize
9 | {
10 | //
11 | // Zusammenfassung:
12 | // Ruft die Position des linken Fensterrands im Verhältnis zum Desktop ab oder legt
13 | // diese fest.
14 | //
15 | // Rückgabewerte:
16 | // Die Position des linken Fensterrands in logischen Einheiten (1/96 Zoll).
17 | double Left { get; set; }
18 |
19 | //
20 | // Zusammenfassung:
21 | // Ruft die Position des oberen Fensterrands im Verhältnis zum Desktop ab oder legt
22 | // diese fest.
23 | //
24 | // Rückgabewerte:
25 | // Die Position des oberen Fensterrands in logischen Einheiten (1/96 ").
26 | double Top { get; set; }
27 |
28 | //
29 | // Zusammenfassung:
30 | // Ruft die Breite des Elements ab bzw. legt diese fest.
31 | //
32 | // Rückgabewerte:
33 | // Die Breite des Elements in geräteunabhängige Einheiten (1/96th inch per unit).Der
34 | // Standardwert ist System.Double.NaN.Dieser Wert muss größer oder gleich 0,0 sein.In
35 | // den Hinweisen finden Sie Informationen über obere Grenzen.
36 | double Width { get; set; }
37 |
38 | //
39 | // Zusammenfassung:
40 | // Ruft die vorgeschlagene Höhe des Elements ab oder legt diese fest.
41 | //
42 | // Rückgabewerte:
43 | // Die Höhe des Elements in geräteunabhängige Einheiten (1/96th inch per unit).Der
44 | // Standardwert ist System.Double.NaN.Dieser Wert muss größer oder gleich 0,0 sein.In
45 | // den Hinweisen finden Sie Informationen über obere Grenzen.
46 | double Height { get; set; }
47 |
48 | //
49 | // Zusammenfassung:
50 | // Ruft einen Wert ab, der angibt, ob ein Fenster wiederhergestellt, minimiert oder
51 | // maximiert ist, oder legt diesen fest.
52 | //
53 | // Rückgabewerte:
54 | // Ein System.Windows.WindowState, der bestimmt, ob ein Fenster wiederhergestellt,
55 | // minimiert oder maximiert ist.Der Standardwert ist System.Windows.WindowState.Normal
56 | // (wiederhergestellt).
57 | WindowState WindowState { get; set; }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/UserProfile/LocalizabilityAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Settings.UserProfile
4 | {
5 | internal class LocalizabilityAttribute : Attribute
6 | {
7 | }
8 | }
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/UserProfile/Profile.cs:
--------------------------------------------------------------------------------
1 | namespace Settings.UserProfile
2 | {
3 | using Settings.Interfaces;
4 | using SettingsModel.Models;
5 | using System.Collections.Generic;
6 | using System.Xml.Serialization;
7 |
8 | ///
9 | /// This class implements the model of the user profile part
10 | /// of the application. Typically, users have implicit run-time
11 | /// settings that should be re-activated when the application
12 | /// is re-started at a later point in time (e.g. window size
13 | /// and position).
14 | ///
15 | /// This class organizes these per user specific profile settings
16 | /// and is responsible for their storage (at program end) and
17 | /// retrieval at the start-up of the application.
18 | ///
19 | public class Profile : IProfile
20 | {
21 | #region fields
22 | protected static readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
23 | #endregion fields
24 |
25 | #region constructor
26 | ///
27 | /// Class constructor
28 | ///
29 | public Profile()
30 | {
31 | // Session Data
32 | WindowPosSz = new SerializableDictionary();
33 | WindowPosSz.Add(MainWindowName, new ViewPosSizeModel(ViewPosSizeModel.DefaultSize));
34 |
35 | LastActiveSolution = LastActiveTargetFile = string.Empty;
36 |
37 | LastActiveSourceFiles = new List();
38 | }
39 | #endregion constructor
40 |
41 | #region properties
42 | ///
43 | /// Gets the key name of the MainWindow item in the collection.
44 | /// Ths name can be used as key in the WindowPosSz property
45 | /// to read and write MainWindow position and size information.
46 | ///
47 | [XmlIgnore]
48 | public string MainWindowName
49 | {
50 | get { return "MainWindow"; }
51 | }
52 |
53 | ///
54 | /// Get/set position and size of MainWindow and other windows in the collection.
55 | ///
56 | [XmlElement(ElementName = "WindowPosSz")]
57 | public SerializableDictionary WindowPosSz { get; set; }
58 |
59 | ///
60 | /// Remember the last active solution file name and path of last session.
61 | ///
62 | /// This can be useful when selecting active document in next session or
63 | /// determining a useful default path when there is no document currently open.
64 | ///
65 | [XmlAttribute(AttributeName = "LastActiveSolution")]
66 | public string LastActiveSolution { get; set; }
67 |
68 | ///
69 | /// Remember the last active path and name of last active document.
70 | ///
71 | /// This can be useful when selecting active document in next session or
72 | /// determining a useful default path when there is no document currently open.
73 | ///
74 | [XmlArrayItem("LastActiveSourceFiles", IsNullable = true)]
75 | public List LastActiveSourceFiles { get; set; }
76 |
77 | ///
78 | /// Remember the last active path and name of last active document.
79 | ///
80 | /// This can be useful when selecting active document in next session or
81 | /// determining a useful default path when there is no document currently open.
82 | ///
83 | [XmlAttribute(AttributeName = "LastActiveTargetFile")]
84 | public string LastActiveTargetFile { get; set; }
85 | #endregion properties
86 |
87 | #region methods
88 | ///
89 | /// Checks the MainWindow for visibility when re-starting application
90 | /// (with different screen configuration).
91 | ///
92 | ///
93 | ///
94 | public void CheckSettingsOnLoad(double SystemParameters_VirtualScreenLeft,
95 | double SystemParameters_VirtualScreenTop)
96 | {
97 | var defaultWindow = new ViewPosSizeModel(ViewPosSizeModel.DefaultSize);
98 |
99 | if (WindowPosSz == null)
100 | {
101 | WindowPosSz = new SerializableDictionary();
102 | WindowPosSz.Add(MainWindowName, defaultWindow);
103 | }
104 | else
105 | {
106 | ViewPosSizeModel win;
107 | if (WindowPosSz.TryGetValue(MainWindowName, out win) == true)
108 | {
109 | if (win.DefaultConstruct == true)
110 | {
111 | WindowPosSz.Remove(MainWindowName);
112 | WindowPosSz.Add(MainWindowName, defaultWindow);
113 | }
114 | }
115 | }
116 |
117 | // Ensure window visibility on different screens and sizes...
118 | defaultWindow.SetValidPos(SystemParameters_VirtualScreenLeft,
119 | SystemParameters_VirtualScreenTop);
120 | }
121 |
122 | ///
123 | /// Updates or inserts the requested window pos size item in the collection.
124 | ///
125 | ///
126 | ///
127 | ///
128 | public void UpdateInsertWindowPosSize(string windowName, ViewPosSizeModel model)
129 | {
130 | ViewPosSizeModel checkModel;
131 | if (WindowPosSz.TryGetValue(windowName, out checkModel) == true)
132 | WindowPosSz.Remove(windowName);
133 |
134 | WindowPosSz.Add(windowName, model);
135 | }
136 |
137 | ///
138 | /// Get the path of the file or empty string if file does not exists on disk.
139 | ///
140 | ///
141 | public string GetLastActivePath()
142 | {
143 | try
144 | {
145 | if (System.IO.File.Exists(LastActiveSolution))
146 | return System.IO.Path.GetDirectoryName(LastActiveSolution);
147 | }
148 | catch
149 | {
150 | }
151 |
152 | return string.Empty;
153 | }
154 | #endregion methods
155 | }
156 | }
157 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/UserProfile/ViewPosSizeModel.cs:
--------------------------------------------------------------------------------
1 | namespace Settings.UserProfile
2 | {
3 | using System;
4 | using System.Windows;
5 | using System.Xml.Serialization;
6 |
7 | ///
8 | /// Simple wrapper class for allowing windows to persist their
9 | /// position, height, and width between user sessions in Properties.Default...
10 | ///
11 | /// The storing of Positions is extended to store collections of
12 | /// window names and positions rather than just one window
13 | ///
14 | [Serializable]
15 | [XmlRoot(ElementName = "ControlPos", IsNullable = true)]
16 | public class ViewPosSizeModel : Settings.Interfaces.IViewPosSizeModel
17 | {
18 | #region fields
19 | private double mX, mY, mWidth, mHeight;
20 | private bool mIsMaximized;
21 | #endregion fields
22 |
23 | #region constructors
24 | ///
25 | /// Standard class constructor
26 | ///
27 | public ViewPosSizeModel()
28 | {
29 | mX = 0;
30 | mY = 0;
31 | mWidth = 0;
32 | mHeight = 0;
33 | mIsMaximized = false;
34 | DefaultConstruct = true;
35 | }
36 |
37 | ///
38 | /// Class cosntructor from coordinates of control
39 | ///
40 | ///
41 | ///
42 | ///
43 | ///
44 | public ViewPosSizeModel(double x,
45 | double y,
46 | double width,
47 | double height,
48 | bool isMaximized = false)
49 | {
50 | mX = x;
51 | mY = y;
52 | mWidth = width;
53 | mHeight = height;
54 | mIsMaximized = isMaximized;
55 | DefaultConstruct = false;
56 | }
57 |
58 | ///
59 | /// Construct from a single object*s propoerties for convinience.
60 | ///
61 | ///
62 | public ViewPosSizeModel(ViewSize vs)
63 | : this(vs.X, vs.Y, vs.Width, vs.Height)
64 | {
65 | }
66 | #endregion constructors
67 |
68 | #region properties
69 | ///
70 | /// Gets a default view size that is used when everything else fails.
71 | ///
72 | public static ViewSize DefaultSize
73 | {
74 | get
75 | {
76 | return new ViewSize(50, 50, 800, 550);
77 | }
78 | }
79 |
80 | ///
81 | /// Get whether this object was created through the default constructor or not
82 | /// (default data values can be easily overwritten by actual data).
83 | ///
84 | [XmlIgnore]
85 | public bool DefaultConstruct { get; private set; }
86 |
87 | ///
88 | /// Get/set X coordinate of control
89 | ///
90 | [XmlAttribute(AttributeName = "X")]
91 | public double X
92 | {
93 | get
94 | {
95 | return mX;
96 | }
97 |
98 | set
99 | {
100 | if (mX != value)
101 | {
102 | mX = value;
103 | }
104 | }
105 | }
106 |
107 | ///
108 | /// Get/set Y coordinate of control
109 | ///
110 | [XmlAttribute(AttributeName = "Y")]
111 | public double Y
112 | {
113 | get
114 | {
115 | return mY;
116 | }
117 |
118 | set
119 | {
120 | if (mY != value)
121 | {
122 | mY = value;
123 | }
124 | }
125 | }
126 |
127 | ///
128 | /// Get/set width of control
129 | ///
130 | [XmlAttribute(AttributeName = "Width")]
131 | public double Width
132 | {
133 | get
134 | {
135 | return mWidth;
136 | }
137 |
138 | set
139 | {
140 | if (mWidth != value)
141 | {
142 | mWidth = value;
143 | }
144 | }
145 | }
146 |
147 | ///
148 | /// Get/set height of control
149 | ///
150 | [XmlAttribute(AttributeName = "Height")]
151 | public double Height
152 | {
153 | get
154 | {
155 | return mHeight;
156 | }
157 |
158 | set
159 | {
160 | if (mHeight != value)
161 | {
162 | mHeight = value;
163 | }
164 | }
165 | }
166 |
167 | ///
168 | /// Get/set whether view is amximized or not
169 | ///
170 | [XmlAttribute(AttributeName = "IsMaximized")]
171 | public bool IsMaximized
172 | {
173 | get
174 | {
175 | return mIsMaximized;
176 | }
177 |
178 | set
179 | {
180 | if (mIsMaximized != value)
181 | {
182 | mIsMaximized = value;
183 | }
184 | }
185 | }
186 | #endregion properties
187 |
188 | #region methods
189 | ///
190 | /// Convinience function to set the position of a view to a valid position
191 | ///
192 | public void SetValidPos(double SystemParameters_VirtualScreenLeft,
193 | double SystemParameters_VirtualScreenTop)
194 | {
195 | // Restore the position with a valid position
196 | if (X < SystemParameters_VirtualScreenLeft)
197 | X = SystemParameters_VirtualScreenLeft;
198 |
199 | if (Y < SystemParameters_VirtualScreenTop)
200 | Y = SystemParameters_VirtualScreenTop;
201 | }
202 |
203 | ///
204 | /// Sets a Windows positions according to the data
205 | /// saved in this object.
206 | ///
207 | ///
208 | public void SetWindowsState(IViewSize view)
209 | {
210 | if (view == null)
211 | return;
212 |
213 | view.Left = this.X;
214 | view.Top = this.Y;
215 | view.Width = this.Width;
216 | view.Height = this.Height;
217 | view.WindowState = (this.IsMaximized == true ? WindowState.Maximized : WindowState.Normal);
218 | }
219 |
220 | ///
221 | /// Sets a Windows positions according to the data
222 | /// saved in this object.
223 | ///
224 | ///
225 | public void GetWindowsState(IViewSize view)
226 | {
227 | if (view == null)
228 | return;
229 |
230 | // Persist window position, width and height from this session
231 | this.X = view.Left;
232 | this.Y = view.Top;
233 | this.Width = view.Width;
234 | this.Height = view.Height;
235 | this.IsMaximized = (view.WindowState == WindowState.Maximized ? true : false);
236 | }
237 | #endregion methods
238 | }
239 | }
240 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/UserProfile/ViewSize.cs:
--------------------------------------------------------------------------------
1 | namespace Settings.UserProfile
2 | {
3 | // 50, 50, 800, 550
4 | public class ViewSize
5 | {
6 | public ViewSize(double x, double y, double width, double height)
7 | {
8 | X = x;
9 | Y = y;
10 | Width = width;
11 | Height = height;
12 | }
13 |
14 | public double X { get; private set; }
15 | public double Y { get; private set; }
16 | public double Width { get; private set; }
17 | public double Height { get; private set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/source/Components/Settings/Settings/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/source/Components/Settings/SettingsModel/ExtensionMethods/SecureStringExtensionMethod.cs:
--------------------------------------------------------------------------------
1 | namespace SettingsModel.ExtensionMethods
2 | {
3 | using System;
4 | using System.Runtime.InteropServices;
5 | using System.Security;
6 |
7 | ///
8 | /// Source: http://blogs.msdn.com/b/fpintos/archive/2009/06/12/how-to-properly-convert-securestring-to-string.aspx
9 | ///
10 | internal static class SecureStringExtensionMethod
11 | {
12 | public static string ConvertToUnsecureString(this SecureString securePassword)
13 | {
14 | if (securePassword == null)
15 | throw new ArgumentNullException("securePassword");
16 |
17 | IntPtr unmanagedString = IntPtr.Zero;
18 | try
19 | {
20 | unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(securePassword);
21 | return Marshal.PtrToStringUni(unmanagedString);
22 | }
23 | finally
24 | {
25 | Marshal.ZeroFreeGlobalAllocUnicode(unmanagedString);
26 | }
27 | }
28 |
29 | public static SecureString ConvertToSecureString(this string password)
30 | {
31 | if (password == null)
32 | throw new ArgumentNullException("password");
33 |
34 | var securePassword = new SecureString();
35 | foreach (char c in password)
36 | securePassword.AppendChar(c);
37 |
38 | securePassword.MakeReadOnly();
39 | return securePassword;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/source/Components/Settings/SettingsModel/Interfaces/IOptionGroup.cs:
--------------------------------------------------------------------------------
1 | namespace SettingsModel.Interfaces
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | ///
7 | /// An option group is a logical group of options
8 | /// (setting values or preferences) of an application.
9 | ///
10 | public interface IOptionGroup
11 | {
12 | ///
13 | /// Gets the name of this options group. This name is used to
14 | /// cluster related options around a technically relevant name.
15 | ///
16 | string Name { get; }
17 |
18 | ///
19 | /// Retrieves the schema of each option in this optiongroup.
20 | ///
21 | ///
22 | IEnumerable GetOptionDefinitions();
23 |
24 | ///
25 | /// Retrieves the schema of an option in this optiongroup.
26 | ///
27 | ///
28 | IOptionsSchema GetOptionDefinition(string optionName);
29 |
30 | ///
31 | /// Gets the value of an option in a given or null
32 | /// if either option or does not exist.
33 | ///
34 | /// Method returns false if option or are not known.
35 | ///
36 | ///
37 | /// Indicates whether option and exist or not.
38 | ///
39 | bool GetValue(string optionName, out object optValue);
40 |
41 | ///
42 | /// Gets the value of an option in a given or
43 | /// throws an exception if either option or
44 | /// does not exist.
45 | ///
46 | /// Method the requested option value if option and are known.
47 | ///
48 | ///
49 | ///
50 | object GetValue(string optionName);
51 |
52 | ///
53 | /// Gets the requested option and returns it as typed <T> value.
54 | /// The method throws an exception if:
55 | /// - requested option value is not stored as typed <T> or
56 | /// - the and option name does not exist.
57 | ///
58 | ///
59 | /// current value of this option.
60 | T GetValue(string optionName);
61 |
62 | ///
63 | /// Sets the value of a given option in this option table.
64 | ///
65 | ///
66 | ///
67 | ///
68 | bool SetValue(string optionName, object newValue);
69 |
70 | ///
71 | /// Add a list item in a list schema
72 | ///
73 | ///
74 | ///
75 | ///
76 | ///
77 | /// Returns true if item was succesfully added or false
78 | /// if schema is not a list schema.
79 | ///
80 | bool List_AddValue(string optionName, string keyName, object value);
81 |
82 | ///
83 | /// Clear all items contained in a list.
84 | ///
85 | ///
86 | ///
87 | bool List_Clear(string optionName);
88 |
89 | ///
90 | /// Create a new option that can hold a list of items.
91 | ///
92 | ///
93 | ///
94 | ///
95 | ///
96 | ///
97 | ///
98 | IOptionsSchema List_CreateOption(string optionName, Type type, bool isOptional, List list);
99 |
100 | ///
101 | /// Gets a list of current values if this schema descripes a List.
102 | /// Return a single value schema as a list of 1 item.
103 | ///
104 | ///
105 | ///
106 | IEnumerable