Minor code improvements

This commit is contained in:
ClemensF 2012-07-07 17:19:10 +02:00
parent 6b25260536
commit 472658a6d9
19 changed files with 301 additions and 175 deletions

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SampleApplication.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<SampleApplication.Properties.Settings>
<setting name="UsePersistentCache" serializeAs="String">
<value>True</value>
</setting>
</SampleApplication.Properties.Settings>
</applicationSettings>
</configuration>

View file

@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using MapControl;
using Caching;
using MapControl;
namespace SampleApplication
{
@ -15,13 +11,9 @@ namespace SampleApplication
{
public MainWindow()
{
bool usePersistentCache = false;
if (usePersistentCache)
if (Properties.Settings.Default.UsePersistentCache)
{
string appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
string cachePath = Path.Combine(appDataFolder, "MapControl", "Cache.fdb");
TileImageLoader.Cache = new FileDbCache("MapControlCache", cachePath) { AutoFlush = false };
TileImageLoader.CreateCache<FileDbCache>();
}
InitializeComponent();

View file

@ -0,0 +1,35 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.225
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SampleApplication.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool UsePersistentCache {
get {
return ((bool)(this["UsePersistentCache"]));
}
}
}
}

View file

@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="SampleApplication.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="UsePersistentCache" Type="System.Boolean" Scope="Application">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -54,6 +54,11 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="SampleItems.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
@ -84,6 +89,13 @@
<Name>MapControl</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SurfaceApplication")]
[assembly: AssemblyDescription("WPF Map Control Sample SurfaceApplication")]
[assembly: AssemblyDescription("WPF Map Control Sample Surface Application")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyProduct("WPF Map Control")]