Example #1
0
        /// <summary>
        /// Loads each preference from a list in Resources to set it's summary
        /// </summary>
        /// <see cref="setPrefSum"/>
        private void loadPrefSum()
        {
            string[] keys = AppUtil.GetResourceStringArray(Resource.Array.prefKeys);

            foreach (string k in keys)
            {
                setPrefSum(k);
            }
        }
Example #2
0
        /// <summary>
        /// Sets the summary for the Preference with the given key
        /// </summary>
        /// <remarks>
        /// The summary will be the current value for the preference
        /// </remarks>
        /// <param name="key">Key.</param>
        private void setPrefSum(string key)
        {
            Preference pref = FindPreference(key);

            string curValue = null;

            switch (key)
            {
            case "send_id":
                curValue = AppConfig.Agency;
                break;

            case "distribution_id":
                curValue = AppConfig.UserID;
                break;

            case "resource_type":
                // Getting list of possible resource types
                string[] resourceTypes = AppUtil.GetResourceStringArray(Resource.Array.typeentries);

                // Getting index of selected value
                int curIndex = AppConfig.ResourceIndex;

                // If that is not a valid index (less then 0) our value is a genric one, otherwise
                curValue = (0 > curIndex) ? "Generic Unit" : resourceTypes[curIndex];
                break;

            case "post_url":
                curValue = AppConfig.PostUrl;
                break;

            case "post_interval":
                curValue = "" + AppConfig.PostInterval;
                break;

            case "icon_scale":

                string givenValue = "" + AppConfig.IconScale;

                string[] scaleEntryList = AppUtil.GetResourceStringArray(Resource.Array.scaleEntries);
                string[] scaleValueList = AppUtil.GetResourceStringArray(Resource.Array.scaleValues);

                int index = System.Array.IndexOf(scaleValueList, givenValue);

                curValue = scaleEntryList[index];
                break;

            case "mapserver_url":
                curValue = "" + AppConfig.MapServerURL;
                break;
            }

            if (!String.IsNullOrWhiteSpace((curValue)))
            {
                pref.Summary = curValue;
            }
        }