WPF settings grouping

Page 1 of 1

0 Replies - 8093 Views - Last Post: 26 May 2013 - 09:12 AM Rate Topic: -----

#1 CasiOo  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1571
  • View blog
  • Posts: 3,529
  • Joined: 05-April 11

WPF settings grouping

Posted 26 May 2013 - 09:12 AM

Right now I'm having my settings in the Settings.settings file which generates a Settings class together with writing in the app.config
A setting example
<?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="GW2_API_Project.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <applicationSettings>
        <GW2_API_Project.Properties.Settings>
            <setting name="GW2API_WvW_Matches" serializeAs="String">
                <value>https://api.guildwars2.com/v1/wvw/matches.json</value>
            </setting>
            <setting name="GW2API_WvW_MatchDetails" serializeAs="String">
                <value>https://api.guildwars2.com/v1/wvw/match_details.json</value>
            </setting>
            <setting name="GW2API_WvW_ObjectiveNames" serializeAs="String">
                <value>https://api.guildwars2.com/v1/wvw/objective_names.json</value>
            </setting>
            <setting name="GW2API_DynamicEvents_Events" serializeAs="String">
                <value>https://api.guildwars2.com/v1/events.json</value>
            </setting>
            <setting name="GW2API_DynamicEvents_EventNames" serializeAs="String">
                <value>https://api.guildwars2.com/v1/event_names.json</value>
            </setting>
            <setting name="GW2API_DynamicEvents_MapNames" serializeAs="String">
                <value>https://api.guildwars2.com/v1/map_names.json</value>
            </setting>
            <setting name="GW2API_DynamicEvents_WorldNames" serializeAs="String">
                <value>https://api.guildwars2.com/v1/world_names.json</value>
            </setting>
        </GW2_API_Project.Properties.Settings>
    </applicationSettings>
</configuration>


And how I use it in my code
WSResponse reponse = ws.PostRequest(Properties.Settings.Default.GW2API_WvW_Matches);



I want to group all the GW2 settings together, so that when there are more settings, they won't all be clumped up and messy
In code (Not working code) I would want something like
String url = Properties.Settings.Default.GW2API.WvW.Matches


I can't figure out how to do it
Also I think it would be preferred to have a separated config file just for the GW2 API settings

Is This A Good Question/Topic? 0
  • +

Page 1 of 1